home *** CD-ROM | disk | FTP | other *** search
MacBinary | 1989-06-01 | 30.9 KB | [TEXT/MPS ] |
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: MacBinary
(archive/macBinary).
Confidence | Program | Detection | Match Type | Support
|
---|
66%
| dexvert
| Compact Compressed (Unix) (archive/compact)
| ext
| Supported |
10%
| dexvert
| MacBinary (archive/macBinary)
| fallback
| Supported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| MacBinary II, Thu Jun 1 15:56:22 1989, modified Thu Jun 1 15:56:22 1989, creator 'MPS ', type ASCII, 31005 bytes "Sample.c" , at 0x799d 382 bytes resource
| default (weak)
| |
99%
| file
| data
| default
| |
74%
| TrID
| Macintosh plain text (MacBinary)
| default
| |
25%
| TrID
| MacBinary 2
| default (weak)
| |
100%
| siegfried
| fmt/1762 MacBinary (II)
| default
| |
100%
| lsar
| MacBinary
| default
|
|
id metadata |
---|
key | value |
---|
macFileType | [TEXT] |
macFileCreator | [MPS ] |
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 63 00 00 00 00 00 00 |..Sample|.c......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 79 1d 00 | 00 01 7e a0 ab 45 66 a0 |.....y..|..~..Ef.|
|00000060| ab 45 66 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.Ef.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 b2 a4 00 00 |........|........|
|00000080| 2f 2a 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |/*------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000d0| 0d 23 0d 23 09 41 70 70 | 6c 65 20 4d 61 63 69 6e |.#.#.App|le Macin|
|000000e0| 74 6f 73 68 20 44 65 76 | 65 6c 6f 70 65 72 20 54 |tosh Dev|eloper T|
|000000f0| 65 63 68 6e 69 63 61 6c | 20 53 75 70 70 6f 72 74 |echnical| Support|
|00000100| 0d 23 0d 23 09 4d 75 6c | 74 69 46 69 6e 64 65 72 |.#.#.Mul|tiFinder|
|00000110| 2d 41 77 61 72 65 20 53 | 69 6d 70 6c 65 20 53 61 |-Aware S|imple Sa|
|00000120| 6d 70 6c 65 20 41 70 70 | 6c 69 63 61 74 69 6f 6e |mple App|lication|
|00000130| 0d 23 0d 23 09 53 61 6d | 70 6c 65 0d 23 0d 23 09 |.#.#.Sam|ple.#.#.|
|00000140| 53 61 6d 70 6c 65 2e 63 | 09 2d 09 43 20 53 6f 75 |Sample.c|.-.C Sou|
|00000150| 72 63 65 0d 23 0d 23 09 | 43 6f 70 79 72 69 67 68 |rce.#.#.|Copyrigh|
|00000160| 74 20 a9 20 31 39 38 39 | 20 41 70 70 6c 65 20 43 |t . 1989| Apple C|
|00000170| 6f 6d 70 75 74 65 72 2c | 20 49 6e 63 2e 0d 23 09 |omputer,| Inc..#.|
|00000180| 41 6c 6c 20 72 69 67 68 | 74 73 20 72 65 73 65 72 |All righ|ts reser|
|00000190| 76 65 64 2e 0d 23 0d 23 | 09 56 65 72 73 69 6f 6e |ved..#.#|.Version|
|000001a0| 73 3a 09 0d 23 09 09 09 | 09 31 2e 30 30 09 09 09 |s:..#...|.1.00...|
|000001b0| 09 30 38 2f 38 38 0d 23 | 09 09 09 09 31 2e 30 31 |.08/88.#|....1.01|
|000001c0| 09 09 09 09 31 31 2f 38 | 38 0d 23 09 09 09 09 31 |....11/8|8.#....1|
|000001d0| 2e 30 32 09 09 09 09 30 | 34 2f 38 39 0d 23 09 09 |.02....0|4/89.#..|
|000001e0| 09 09 31 2e 30 33 09 09 | 09 09 30 36 2f 38 39 0d |..1.03..|..06/89.|
|000001f0| 23 0d 23 09 43 6f 6d 70 | 6f 6e 65 6e 74 73 3a 0d |#.#.Comp|onents:.|
|00000200| 23 09 09 09 09 53 61 6d | 70 6c 65 2e 70 09 09 09 |#....Sam|ple.p...|
|00000210| 4a 75 6e 65 20 31 2c 20 | 31 39 38 39 0d 23 09 09 |June 1, |1989.#..|
|00000220| 09 09 53 61 6d 70 6c 65 | 2e 63 09 09 09 4a 75 6e |..Sample|.c...Jun|
|00000230| 65 20 31 2c 20 31 39 38 | 39 0d 23 09 09 09 09 53 |e 1, 198|9.#....S|
|00000240| 61 6d 70 6c 65 2e 61 09 | 09 09 4a 75 6e 65 20 31 |ample.a.|..June 1|
|00000250| 2c 20 31 39 38 39 0d 23 | 09 09 09 09 53 61 6d 70 |, 1989.#|....Samp|
|00000260| 6c 65 2e 69 6e 63 31 2e | 61 09 09 4a 75 6e 65 20 |le.inc1.|a..June |
|00000270| 31 2c 20 31 39 38 39 0d | 23 09 09 09 09 53 61 6d |1, 1989.|#....Sam|
|00000280| 70 6c 65 4d 69 73 63 2e | 61 09 09 4a 75 6e 65 20 |pleMisc.|a..June |
|00000290| 31 2c 20 31 39 38 39 0d | 23 09 09 09 09 53 61 6d |1, 1989.|#....Sam|
|000002a0| 70 6c 65 2e 72 09 09 09 | 4a 75 6e 65 20 31 2c 20 |ple.r...|June 1, |
|000002b0| 31 39 38 39 0d 23 09 09 | 09 09 53 61 6d 70 6c 65 |1989.#..|..Sample|
|000002c0| 2e 68 09 09 09 4a 75 6e | 65 20 31 2c 20 31 39 38 |.h...Jun|e 1, 198|
|000002d0| 39 0d 23 09 09 09 09 50 | 53 61 6d 70 6c 65 2e 6d |9.#....P|Sample.m|
|000002e0| 61 6b 65 09 09 4a 75 6e | 65 20 31 2c 20 31 39 38 |ake..Jun|e 1, 198|
|000002f0| 39 0d 23 09 09 09 09 43 | 53 61 6d 70 6c 65 2e 6d |9.#....C|Sample.m|
|00000300| 61 6b 65 09 09 4a 75 6e | 65 20 31 2c 20 31 39 38 |ake..Jun|e 1, 198|
|00000310| 39 0d 23 09 09 09 09 41 | 53 61 6d 70 6c 65 2e 6d |9.#....A|Sample.m|
|00000320| 61 6b 65 09 09 4a 75 6e | 65 20 31 2c 20 31 39 38 |ake..Jun|e 1, 198|
|00000330| 39 0d 23 0d 23 09 53 61 | 6d 70 6c 65 20 69 73 20 |9.#.#.Sa|mple is |
|00000340| 61 6e 20 65 78 61 6d 70 | 6c 65 20 61 70 70 6c 69 |an examp|le appli|
|00000350| 63 61 74 69 6f 6e 20 74 | 68 61 74 20 64 65 6d 6f |cation t|hat demo|
|00000360| 6e 73 74 72 61 74 65 73 | 20 68 6f 77 20 74 6f 0d |nstrates| how to.|
|00000370| 23 09 69 6e 69 74 69 61 | 6c 69 7a 65 20 74 68 65 |#.initia|lize the|
|00000380| 20 63 6f 6d 6d 6f 6e 6c | 79 20 75 73 65 64 20 74 | commonl|y used t|
|00000390| 6f 6f 6c 62 6f 78 20 6d | 61 6e 61 67 65 72 73 2c |oolbox m|anagers,|
|000003a0| 20 6f 70 65 72 61 74 65 | 20 0d 23 09 73 75 63 63 | operate| .#.succ|
|000003b0| 65 73 73 66 75 6c 6c 79 | 20 75 6e 64 65 72 20 4d |essfully| under M|
|000003c0| 75 6c 74 69 46 69 6e 64 | 65 72 2c 20 68 61 6e 64 |ultiFind|er, hand|
|000003d0| 6c 65 20 64 65 73 6b 20 | 61 63 63 65 73 73 6f 72 |le desk |accessor|
|000003e0| 69 65 73 2c 20 0d 23 09 | 61 6e 64 20 63 72 65 61 |ies, .#.|and crea|
|000003f0| 74 65 2c 20 67 72 6f 77 | 2c 20 61 6e 64 20 7a 6f |te, grow|, and zo|
|00000400| 6f 6d 20 77 69 6e 64 6f | 77 73 2e 0d 23 0d 23 09 |om windo|ws..#.#.|
|00000410| 49 74 20 64 6f 65 73 20 | 6e 6f 74 20 62 79 20 61 |It does |not by a|
|00000420| 6e 79 20 6d 65 61 6e 73 | 20 64 65 6d 6f 6e 73 74 |ny means| demonst|
|00000430| 72 61 74 65 20 61 6c 6c | 20 74 68 65 20 74 65 63 |rate all| the tec|
|00000440| 68 6e 69 71 75 65 73 20 | 0d 23 09 79 6f 75 20 6e |hniques |.#.you n|
|00000450| 65 65 64 20 66 6f 72 20 | 61 20 6c 61 72 67 65 20 |eed for |a large |
|00000460| 61 70 70 6c 69 63 61 74 | 69 6f 6e 2e 20 49 6e 20 |applicat|ion. In |
|00000470| 70 61 72 74 69 63 75 6c | 61 72 2c 20 53 61 6d 70 |particul|ar, Samp|
|00000480| 6c 65 20 0d 23 09 64 6f | 65 73 20 6e 6f 74 20 63 |le .#.do|es not c|
|00000490| 6f 76 65 72 20 65 78 63 | 65 70 74 69 6f 6e 20 68 |over exc|eption h|
|000004a0| 61 6e 64 6c 69 6e 67 2c | 20 6d 75 6c 74 69 70 6c |andling,| multipl|
|000004b0| 65 20 77 69 6e 64 6f 77 | 73 2f 64 6f 63 75 6d 65 |e window|s/docume|
|000004c0| 6e 74 73 2c 20 0d 23 09 | 73 6f 70 68 69 73 74 69 |nts, .#.|sophisti|
|000004d0| 63 61 74 65 64 20 6d 65 | 6d 6f 72 79 20 6d 61 6e |cated me|mory man|
|000004e0| 61 67 65 6d 65 6e 74 2c | 20 70 72 69 6e 74 69 6e |agement,| printin|
|000004f0| 67 2c 20 6f 72 20 75 6e | 64 6f 2e 20 41 6c 6c 20 |g, or un|do. All |
|00000500| 6f 66 20 0d 23 09 74 68 | 65 73 65 20 61 72 65 20 |of .#.th|ese are |
|00000510| 76 69 74 61 6c 20 70 61 | 72 74 73 20 6f 66 20 61 |vital pa|rts of a|
|00000520| 20 6e 6f 72 6d 61 6c 20 | 66 75 6c 6c 2d 73 69 7a | normal |full-siz|
|00000530| 65 64 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 2e 0d |ed appli|cation..|
|00000540| 23 0d 23 09 54 68 69 73 | 20 61 70 70 6c 69 63 61 |#.#.This| applica|
|00000550| 74 69 6f 6e 20 69 73 20 | 61 6e 20 65 78 61 6d 70 |tion is |an examp|
|00000560| 6c 65 20 6f 66 20 74 68 | 65 20 66 6f 72 6d 20 6f |le of th|e form o|
|00000570| 66 20 61 20 4d 61 63 69 | 6e 74 6f 73 68 20 0d 23 |f a Maci|ntosh .#|
|00000580| 09 61 70 70 6c 69 63 61 | 74 69 6f 6e 3b 20 69 74 |.applica|tion; it|
|00000590| 20 69 73 20 4e 4f 54 20 | 61 20 74 65 6d 70 6c 61 | is NOT |a templa|
|000005a0| 74 65 2e 20 49 74 20 69 | 73 20 4e 4f 54 20 69 6e |te. It i|s NOT in|
|000005b0| 74 65 6e 64 65 64 20 74 | 6f 20 62 65 20 0d 23 09 |tended t|o be .#.|
|000005c0| 75 73 65 64 20 61 73 20 | 61 20 66 6f 75 6e 64 61 |used as |a founda|
|000005d0| 74 69 6f 6e 20 66 6f 72 | 20 74 68 65 20 6e 65 78 |tion for| the nex|
|000005e0| 74 20 77 6f 72 6c 64 2d | 63 6c 61 73 73 2c 20 62 |t world-|class, b|
|000005f0| 65 73 74 2d 73 65 6c 6c | 69 6e 67 2c 20 0d 23 09 |est-sell|ing, .#.|
|00000600| 36 30 30 4b 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |600K app|lication|
|00000610| 2e 20 41 20 73 74 69 63 | 6b 20 66 69 67 75 72 65 |. A stic|k figure|
|00000620| 20 64 72 61 77 69 6e 67 | 20 6f 66 20 74 68 65 20 | drawing| of the |
|00000630| 68 75 6d 61 6e 20 62 6f | 64 79 20 6d 61 79 20 0d |human bo|dy may .|
|00000640| 23 09 62 65 20 61 20 67 | 6f 6f 64 20 65 78 61 6d |#.be a g|ood exam|
|00000650| 70 6c 65 20 6f 66 20 74 | 68 65 20 66 6f 72 6d 20 |ple of t|he form |
|00000660| 66 6f 72 20 61 20 70 61 | 69 6e 74 69 6e 67 2c 20 |for a pa|inting, |
|00000670| 62 75 74 20 74 68 61 74 | 20 64 6f 65 73 20 6e 6f |but that| does no|
|00000680| 74 20 0d 23 09 6d 65 61 | 6e 20 69 74 20 73 68 6f |t .#.mea|n it sho|
|00000690| 75 6c 64 20 62 65 20 75 | 73 65 64 20 61 73 20 74 |uld be u|sed as t|
|000006a0| 68 65 20 62 61 73 69 73 | 20 66 6f 72 20 74 68 65 |he basis| for the|
|000006b0| 20 6e 65 78 74 20 4d 6f | 6e 61 20 4c 69 73 61 2e | next Mo|na Lisa.|
|000006c0| 0d 23 0d 23 09 57 65 20 | 72 65 63 6f 6d 6d 65 6e |.#.#.We |recommen|
|000006d0| 64 20 74 68 61 74 20 79 | 6f 75 20 72 65 76 69 65 |d that y|ou revie|
|000006e0| 77 20 74 68 69 73 20 70 | 72 6f 67 72 61 6d 20 6f |w this p|rogram o|
|000006f0| 72 20 54 45 53 61 6d 70 | 6c 65 20 62 65 66 6f 72 |r TESamp|le befor|
|00000700| 65 20 0d 23 09 62 65 67 | 69 6e 6e 69 6e 67 20 61 |e .#.beg|inning a|
|00000710| 20 6e 65 77 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | new app|lication|
|00000720| 2e 0d 23 0d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |..#.----|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000770| 2d 2d 2a 2f 0d 0d 0d 2f | 2a 20 53 65 67 6d 65 6e |--*/.../|* Segmen|
|00000780| 74 61 74 69 6f 6e 20 73 | 74 72 61 74 65 67 79 3a |tation s|trategy:|
|00000790| 0d 0d 20 20 20 54 68 69 | 73 20 70 72 6f 67 72 61 |.. Thi|s progra|
|000007a0| 6d 20 63 6f 6e 73 69 73 | 74 73 20 6f 66 20 74 68 |m consis|ts of th|
|000007b0| 72 65 65 20 73 65 67 6d | 65 6e 74 73 2e 20 4d 61 |ree segm|ents. Ma|
|000007c0| 69 6e 20 63 6f 6e 74 61 | 69 6e 73 20 6d 6f 73 74 |in conta|ins most|
|000007d0| 20 6f 66 20 74 68 65 20 | 63 6f 64 65 2c 0d 20 20 | of the |code,. |
|000007e0| 20 69 6e 63 6c 75 64 69 | 6e 67 20 74 68 65 20 4d | includi|ng the M|
|000007f0| 50 57 20 6c 69 62 72 61 | 72 69 65 73 2c 20 61 6e |PW libra|ries, an|
|00000800| 64 20 74 68 65 20 6d 61 | 69 6e 20 70 72 6f 67 72 |d the ma|in progr|
|00000810| 61 6d 2e 20 49 6e 69 74 | 69 61 6c 69 7a 65 20 63 |am. Init|ialize c|
|00000820| 6f 6e 74 61 69 6e 73 0d | 20 20 20 63 6f 64 65 20 |ontains.| code |
|00000830| 74 68 61 74 20 69 73 20 | 6f 6e 6c 79 20 75 73 65 |that is |only use|
|00000840| 64 20 6f 6e 63 65 2c 20 | 64 75 72 69 6e 67 20 73 |d once, |during s|
|00000850| 74 61 72 74 75 70 2c 20 | 61 6e 64 20 63 61 6e 20 |tartup, |and can |
|00000860| 62 65 20 75 6e 6c 6f 61 | 64 65 64 20 61 66 74 65 |be unloa|ded afte|
|00000870| 72 20 74 68 65 0d 20 20 | 20 70 72 6f 67 72 61 6d |r the. | program|
|00000880| 20 73 74 61 72 74 73 2e | 20 25 41 35 49 6e 69 74 | starts.| %A5Init|
|00000890| 20 69 73 20 61 75 74 6f | 6d 61 74 69 63 61 6c 6c | is auto|maticall|
|000008a0| 79 20 63 72 65 61 74 65 | 64 20 62 79 20 74 68 65 |y create|d by the|
|000008b0| 20 4c 69 6e 6b 65 72 20 | 74 6f 20 69 6e 69 74 69 | Linker |to initi|
|000008c0| 61 6c 69 7a 65 0d 20 20 | 20 67 6c 6f 62 61 6c 73 |alize. | globals|
|000008d0| 20 66 6f 72 20 74 68 65 | 20 4d 50 57 20 6c 69 62 | for the| MPW lib|
|000008e0| 72 61 72 69 65 73 20 61 | 6e 64 20 69 73 20 75 6e |raries a|nd is un|
|000008f0| 6c 6f 61 64 65 64 20 72 | 69 67 68 74 20 61 77 61 |loaded r|ight awa|
|00000900| 79 2e 20 2a 2f 0d 0d 0d | 2f 2a 20 53 65 74 50 6f |y. */...|/* SetPo|
|00000910| 72 74 20 73 74 72 61 74 | 65 67 79 3a 0d 0d 20 20 |rt strat|egy:.. |
|00000920| 20 54 6f 6f 6c 62 6f 78 | 20 72 6f 75 74 69 6e 65 | Toolbox| routine|
|00000930| 73 20 64 6f 20 6e 6f 74 | 20 63 68 61 6e 67 65 20 |s do not| change |
|00000940| 74 68 65 20 63 75 72 72 | 65 6e 74 20 70 6f 72 74 |the curr|ent port|
|00000950| 2e 20 49 6e 20 73 70 69 | 74 65 20 6f 66 20 74 68 |. In spi|te of th|
|00000960| 69 73 2c 20 69 6e 20 74 | 68 69 73 0d 20 20 20 70 |is, in t|his. p|
|00000970| 72 6f 67 72 61 6d 20 77 | 65 20 75 73 65 20 61 20 |rogram w|e use a |
|00000980| 73 74 72 61 74 65 67 79 | 20 6f 66 20 63 61 6c 6c |strategy| of call|
|00000990| 69 6e 67 20 53 65 74 50 | 6f 72 74 20 77 68 65 6e |ing SetP|ort when|
|000009a0| 65 76 65 72 20 77 65 20 | 77 61 6e 74 20 74 6f 20 |ever we |want to |
|000009b0| 64 72 61 77 20 6f 72 0d | 20 20 20 6d 61 6b 65 20 |draw or.| make |
|000009c0| 63 61 6c 6c 73 20 77 68 | 69 63 68 20 64 65 70 65 |calls wh|ich depe|
|000009d0| 6e 64 20 6f 6e 20 74 68 | 65 20 63 75 72 72 65 6e |nd on th|e curren|
|000009e0| 74 20 70 6f 72 74 2e 20 | 54 68 69 73 20 6d 61 6b |t port. |This mak|
|000009f0| 65 73 20 75 73 20 6c 65 | 73 73 20 76 75 6c 6e 65 |es us le|ss vulne|
|00000a00| 72 61 62 6c 65 0d 20 20 | 20 74 6f 20 62 75 67 73 |rable. | to bugs|
|00000a10| 20 69 6e 20 6f 74 68 65 | 72 20 73 6f 66 74 77 61 | in othe|r softwa|
|00000a20| 72 65 20 77 68 69 63 68 | 20 6d 69 67 68 74 20 61 |re which| might a|
|00000a30| 6c 74 65 72 20 74 68 65 | 20 63 75 72 72 65 6e 74 |lter the| current|
|00000a40| 20 70 6f 72 74 20 28 73 | 75 63 68 20 61 73 20 74 | port (s|uch as t|
|00000a50| 68 65 0d 20 20 20 62 75 | 67 20 28 66 65 61 74 75 |he. bu|g (featu|
|00000a60| 72 65 3f 29 20 69 6e 20 | 6d 61 6e 79 20 64 65 73 |re?) in |many des|
|00000a70| 6b 20 61 63 63 65 73 73 | 6f 72 69 65 73 20 77 68 |k access|ories wh|
|00000a80| 69 63 68 20 63 68 61 6e | 67 65 20 74 68 65 20 70 |ich chan|ge the p|
|00000a90| 6f 72 74 20 6f 6e 20 4f | 70 65 6e 44 65 73 6b 41 |ort on O|penDeskA|
|00000aa0| 63 63 29 2e 0d 20 20 20 | 48 6f 70 65 66 75 6c 6c |cc).. |Hopefull|
|00000ab0| 79 2c 20 74 68 69 73 20 | 61 6c 73 6f 20 6d 61 6b |y, this |also mak|
|00000ac0| 65 73 20 74 68 65 20 72 | 6f 75 74 69 6e 65 73 20 |es the r|outines |
|00000ad0| 66 72 6f 6d 20 74 68 69 | 73 20 70 72 6f 67 72 61 |from thi|s progra|
|00000ae0| 6d 20 6d 6f 72 65 20 73 | 65 6c 66 2d 63 6f 6e 74 |m more s|elf-cont|
|00000af0| 61 69 6e 65 64 2c 0d 20 | 20 20 73 69 6e 63 65 20 |ained,. | since |
|00000b00| 74 68 65 79 20 64 6f 6e | 27 74 20 64 65 70 65 6e |they don|'t depen|
|00000b10| 64 20 6f 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |d on the| current|
|00000b20| 20 70 6f 72 74 20 73 65 | 74 74 69 6e 67 2e 20 2a | port se|tting. *|
|00000b30| 2f 0d 0d 0d 23 69 6e 63 | 6c 75 64 65 20 3c 56 61 |/...#inc|lude <Va|
|00000b40| 6c 75 65 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |lues.h>.|#include|
|00000b50| 20 3c 54 79 70 65 73 2e | 68 3e 0d 23 69 6e 63 6c | <Types.|h>.#incl|
|00000b60| 75 64 65 20 3c 52 65 73 | 6f 75 72 63 65 73 2e 68 |ude <Res|ources.h|
|00000b70| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 51 75 69 63 |>.#inclu|de <Quic|
|00000b80| 6b 44 72 61 77 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |kDraw.h>|.#includ|
|00000b90| 65 20 3c 46 6f 6e 74 73 | 2e 68 3e 0d 23 69 6e 63 |e <Fonts|.h>.#inc|
|00000ba0| 6c 75 64 65 20 3c 45 76 | 65 6e 74 73 2e 68 3e 0d |lude <Ev|ents.h>.|
|00000bb0| 23 69 6e 63 6c 75 64 65 | 20 3c 57 69 6e 64 6f 77 |#include| <Window|
|00000bc0| 73 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 4d |s.h>.#in|clude <M|
|00000bd0| 65 6e 75 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |enus.h>.|#include|
|00000be0| 20 3c 54 65 78 74 45 64 | 69 74 2e 68 3e 0d 23 69 | <TextEd|it.h>.#i|
|00000bf0| 6e 63 6c 75 64 65 20 3c | 44 69 61 6c 6f 67 73 2e |nclude <|Dialogs.|
|00000c00| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 44 65 73 |h>.#incl|ude <Des|
|00000c10| 6b 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 54 |k.h>.#in|clude <T|
|00000c20| 6f 6f 6c 55 74 69 6c 73 | 2e 68 3e 0d 23 69 6e 63 |oolUtils|.h>.#inc|
|00000c30| 6c 75 64 65 20 3c 4d 65 | 6d 6f 72 79 2e 68 3e 0d |lude <Me|mory.h>.|
|00000c40| 23 69 6e 63 6c 75 64 65 | 20 3c 53 65 67 4c 6f 61 |#include| <SegLoa|
|00000c50| 64 2e 68 3e 0d 23 69 6e | 63 6c 75 64 65 20 3c 46 |d.h>.#in|clude <F|
|00000c60| 69 6c 65 73 2e 68 3e 0d | 23 69 6e 63 6c 75 64 65 |iles.h>.|#include|
|00000c70| 20 3c 4f 53 55 74 69 6c | 73 2e 68 3e 0d 23 69 6e | <OSUtil|s.h>.#in|
|00000c80| 63 6c 75 64 65 20 3c 4f | 53 45 76 65 6e 74 73 2e |clude <O|SEvents.|
|00000c90| 68 3e 0d 23 69 6e 63 6c | 75 64 65 20 3c 44 69 73 |h>.#incl|ude <Dis|
|00000ca0| 6b 49 6e 69 74 2e 68 3e | 0d 23 69 6e 63 6c 75 64 |kInit.h>|.#includ|
|00000cb0| 65 20 3c 50 61 63 6b 61 | 67 65 73 2e 68 3e 0d 23 |e <Packa|ges.h>.#|
|00000cc0| 69 6e 63 6c 75 64 65 20 | 3c 54 72 61 70 73 2e 68 |include |<Traps.h|
|00000cd0| 3e 0d 23 69 6e 63 6c 75 | 64 65 20 3c 53 61 6d 70 |>.#inclu|de <Samp|
|00000ce0| 6c 65 2e 68 3e 09 09 2f | 2a 20 62 72 69 6e 67 20 |le.h>../|* bring |
|00000cf0| 69 6e 20 61 6c 6c 20 74 | 68 65 20 23 64 65 66 69 |in all t|he #defi|
|00000d00| 6e 65 73 20 66 6f 72 20 | 53 61 6d 70 6c 65 20 2a |nes for |Sample *|
|00000d10| 2f 0d 0d 0d 2f 2a 20 54 | 68 65 20 22 67 22 20 70 |/.../* T|he "g" p|
|00000d20| 72 65 66 69 78 20 69 73 | 20 75 73 65 64 20 74 6f |refix is| used to|
|00000d30| 20 65 6d 70 68 61 73 69 | 7a 65 20 74 68 61 74 20 | emphasi|ze that |
|00000d40| 61 20 76 61 72 69 61 62 | 6c 65 20 69 73 20 67 6c |a variab|le is gl|
|00000d50| 6f 62 61 6c 2e 20 2a 2f | 0d 0d 2f 2a 20 47 4d 61 |obal. */|../* GMa|
|00000d60| 63 20 69 73 20 75 73 65 | 64 20 74 6f 20 68 6f 6c |c is use|d to hol|
|00000d70| 64 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |d the re|sult of |
|00000d80| 61 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 63 61 |a SysEnv|irons ca|
|00000d90| 6c 6c 2e 20 54 68 69 73 | 20 6d 61 6b 65 73 0d 20 |ll. This| makes. |
|00000da0| 20 20 69 74 20 63 6f 6e | 76 65 6e 69 65 6e 74 20 | it con|venient |
|00000db0| 66 6f 72 20 61 6e 79 20 | 72 6f 75 74 69 6e 65 20 |for any |routine |
|00000dc0| 74 6f 20 63 68 65 63 6b | 20 74 68 65 20 65 6e 76 |to check| the env|
|00000dd0| 69 72 6f 6e 6d 65 6e 74 | 2e 20 2a 2f 0d 53 79 73 |ironment|. */.Sys|
|00000de0| 45 6e 76 52 65 63 09 67 | 4d 61 63 3b 09 09 09 09 |EnvRec.g|Mac;....|
|00000df0| 2f 2a 20 73 65 74 20 75 | 70 20 62 79 20 49 6e 69 |/* set u|p by Ini|
|00000e00| 74 69 61 6c 69 7a 65 20 | 2a 2f 0d 0d 2f 2a 20 47 |tialize |*/../* G|
|00000e10| 48 61 73 57 61 69 74 4e | 65 78 74 45 76 65 6e 74 |HasWaitN|extEvent|
|00000e20| 20 69 73 20 73 65 74 20 | 61 74 20 73 74 61 72 74 | is set |at start|
|00000e30| 75 70 2c 20 61 6e 64 20 | 74 65 6c 6c 73 20 77 68 |up, and |tells wh|
|00000e40| 65 74 68 65 72 20 74 68 | 65 20 57 61 69 74 4e 65 |ether th|e WaitNe|
|00000e50| 78 74 45 76 65 6e 74 0d | 20 20 20 74 72 61 70 20 |xtEvent.| trap |
|00000e60| 69 73 20 61 76 61 69 6c | 61 62 6c 65 2e 20 49 66 |is avail|able. If|
|00000e70| 20 69 74 20 69 73 20 66 | 61 6c 73 65 2c 20 77 65 | it is f|alse, we|
|00000e80| 20 6b 6e 6f 77 20 74 68 | 61 74 20 77 65 20 6d 75 | know th|at we mu|
|00000e90| 73 74 20 63 61 6c 6c 20 | 47 65 74 4e 65 78 74 45 |st call |GetNextE|
|00000ea0| 76 65 6e 74 2e 20 2a 2f | 0d 42 6f 6f 6c 65 61 6e |vent. */|.Boolean|
|00000eb0| 09 09 67 48 61 73 57 61 | 69 74 4e 65 78 74 45 76 |..gHasWa|itNextEv|
|00000ec0| 65 6e 74 3b 09 2f 2a 20 | 73 65 74 20 75 70 20 62 |ent;./* |set up b|
|00000ed0| 79 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 2a 2f 0d |y Initia|lize */.|
|00000ee0| 0d 2f 2a 20 47 49 6e 42 | 61 63 6b 67 72 6f 75 6e |./* GInB|ackgroun|
|00000ef0| 64 20 69 73 20 6d 61 69 | 6e 74 61 69 6e 65 64 20 |d is mai|ntained |
|00000f00| 62 79 20 6f 75 72 20 6f | 73 45 76 65 6e 74 20 68 |by our o|sEvent h|
|00000f10| 61 6e 64 6c 69 6e 67 20 | 72 6f 75 74 69 6e 65 73 |andling |routines|
|00000f20| 2e 20 41 6e 79 20 70 61 | 72 74 20 6f 66 0d 20 20 |. Any pa|rt of. |
|00000f30| 20 74 68 65 20 70 72 6f | 67 72 61 6d 20 63 61 6e | the pro|gram can|
|00000f40| 20 63 68 65 63 6b 20 69 | 74 20 74 6f 20 66 69 6e | check i|t to fin|
|00000f50| 64 20 6f 75 74 20 69 66 | 20 69 74 20 69 73 20 63 |d out if| it is c|
|00000f60| 75 72 72 65 6e 74 6c 79 | 20 69 6e 20 74 68 65 20 |urrently| in the |
|00000f70| 62 61 63 6b 67 72 6f 75 | 6e 64 2e 20 2a 2f 0d 42 |backgrou|nd. */.B|
|00000f80| 6f 6f 6c 65 61 6e 09 09 | 67 49 6e 42 61 63 6b 67 |oolean..|gInBackg|
|00000f90| 72 6f 75 6e 64 3b 09 09 | 2f 2a 20 6d 61 69 6e 74 |round;..|/* maint|
|00000fa0| 61 69 6e 65 64 20 62 79 | 20 49 6e 69 74 69 61 6c |ained by| Initial|
|00000fb0| 69 7a 65 20 61 6e 64 20 | 44 6f 45 76 65 6e 74 20 |ize and |DoEvent |
|00000fc0| 2a 2f 0d 0d 0d 2f 2a 20 | 54 68 65 20 66 6f 6c 6c |*/.../* |The foll|
|00000fd0| 6f 77 69 6e 67 20 67 6c | 6f 62 61 6c 73 20 61 72 |owing gl|obals ar|
|00000fe0| 65 20 74 68 65 20 73 74 | 61 74 65 20 6f 66 20 74 |e the st|ate of t|
|00000ff0| 68 65 20 77 69 6e 64 6f | 77 2e 20 49 66 20 77 65 |he windo|w. If we|
|00001000| 20 73 75 70 70 6f 72 74 | 65 64 20 6d 6f 72 65 20 | support|ed more |
|00001010| 74 68 61 6e 0d 20 20 20 | 6f 6e 65 20 77 69 6e 64 |than. |one wind|
|00001020| 6f 77 2c 20 74 68 65 79 | 20 77 6f 75 6c 64 20 62 |ow, they| would b|
|00001030| 65 20 61 74 74 61 74 63 | 68 65 64 20 74 6f 20 65 |e attatc|hed to e|
|00001040| 61 63 68 20 64 6f 63 75 | 6d 65 6e 74 2c 20 72 61 |ach docu|ment, ra|
|00001050| 74 68 65 72 20 74 68 61 | 6e 20 67 6c 6f 62 61 6c |ther tha|n global|
|00001060| 73 2e 20 2a 2f 0d 0d 2f | 2a 20 47 53 74 6f 70 70 |s. */../|* GStopp|
|00001070| 65 64 20 74 65 6c 6c 73 | 20 77 68 65 74 68 65 72 |ed tells| whether|
|00001080| 20 74 68 65 20 73 74 6f | 70 20 6c 69 67 68 74 20 | the sto|p light |
|00001090| 69 73 20 63 75 72 72 65 | 6e 74 6c 79 20 6f 6e 20 |is curre|ntly on |
|000010a0| 73 74 6f 70 20 6f 72 20 | 67 6f 2e 20 2a 2f 0d 42 |stop or |go. */.B|
|000010b0| 6f 6f 6c 65 61 6e 09 09 | 67 53 74 6f 70 70 65 64 |oolean..|gStopped|
|000010c0| 3b 09 09 09 2f 2a 20 6d | 61 69 6e 74 61 69 6e 65 |;.../* m|aintaine|
|000010d0| 64 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |d by Ini|tialize |
|000010e0| 61 6e 64 20 53 65 74 4c | 69 67 68 74 20 2a 2f 0d |and SetL|ight */.|
|000010f0| 0d 2f 2a 20 47 53 74 6f | 70 52 65 63 74 20 61 6e |./* GSto|pRect an|
|00001100| 64 20 67 47 6f 52 65 63 | 74 20 61 72 65 20 74 68 |d gGoRec|t are th|
|00001110| 65 20 72 65 63 74 61 6e | 67 6c 65 73 20 6f 66 20 |e rectan|gles of |
|00001120| 74 68 65 20 74 77 6f 20 | 73 74 6f 70 20 6c 69 67 |the two |stop lig|
|00001130| 68 74 73 20 69 6e 20 74 | 68 65 20 77 69 6e 64 6f |hts in t|he windo|
|00001140| 77 2e 20 2a 2f 0d 52 65 | 63 74 09 09 67 53 74 6f |w. */.Re|ct..gSto|
|00001150| 70 52 65 63 74 3b 09 09 | 09 2f 2a 20 73 65 74 20 |pRect;..|./* set |
|00001160| 75 70 20 62 79 20 49 6e | 69 74 69 61 6c 69 7a 65 |up by In|itialize|
|00001170| 20 2a 2f 0d 52 65 63 74 | 09 09 67 47 6f 52 65 63 | */.Rect|..gGoRec|
|00001180| 74 3b 09 09 09 2f 2a 20 | 73 65 74 20 75 70 20 62 |t;.../* |set up b|
|00001190| 79 20 49 6e 69 74 69 61 | 6c 69 7a 65 20 2a 2f 0d |y Initia|lize */.|
|000011a0| 0d 0d 2f 2a 20 48 65 72 | 65 20 61 72 65 20 64 65 |../* Her|e are de|
|000011b0| 63 6c 61 72 61 74 69 6f | 6e 73 20 66 6f 72 20 61 |claratio|ns for a|
|000011c0| 6c 6c 20 6f 66 20 74 68 | 65 20 43 20 72 6f 75 74 |ll of th|e C rout|
|000011d0| 69 6e 65 73 2e 20 49 6e | 20 4d 50 57 20 33 2e 30 |ines. In| MPW 3.0|
|000011e0| 20 77 65 20 63 61 6e 20 | 75 73 65 0d 20 20 20 61 | we can |use. a|
|000011f0| 63 74 75 61 6c 20 70 72 | 6f 74 6f 74 79 70 65 73 |ctual pr|ototypes|
|00001200| 20 66 6f 72 20 70 61 72 | 61 6d 65 74 65 72 20 74 | for par|ameter t|
|00001210| 79 70 65 20 63 68 65 63 | 6b 69 6e 67 2e 20 2a 2f |ype chec|king. */|
|00001220| 0d 76 6f 69 64 20 45 76 | 65 6e 74 4c 6f 6f 70 28 |.void Ev|entLoop(|
|00001230| 20 76 6f 69 64 20 29 3b | 0d 76 6f 69 64 20 44 6f | void );|.void Do|
|00001240| 45 76 65 6e 74 28 20 45 | 76 65 6e 74 52 65 63 6f |Event( E|ventReco|
|00001250| 72 64 20 2a 65 76 65 6e | 74 20 29 3b 0d 76 6f 69 |rd *even|t );.voi|
|00001260| 64 20 41 64 6a 75 73 74 | 43 75 72 73 6f 72 28 20 |d Adjust|Cursor( |
|00001270| 50 6f 69 6e 74 20 6d 6f | 75 73 65 2c 20 52 67 6e |Point mo|use, Rgn|
|00001280| 48 61 6e 64 6c 65 20 72 | 65 67 69 6f 6e 20 29 3b |Handle r|egion );|
|00001290| 0d 76 6f 69 64 20 47 65 | 74 47 6c 6f 62 61 6c 4d |.void Ge|tGlobalM|
|000012a0| 6f 75 73 65 28 20 50 6f | 69 6e 74 20 2a 6d 6f 75 |ouse( Po|int *mou|
|000012b0| 73 65 20 29 3b 0d 76 6f | 69 64 20 44 6f 55 70 64 |se );.vo|id DoUpd|
|000012c0| 61 74 65 28 20 57 69 6e | 64 6f 77 50 74 72 20 77 |ate( Win|dowPtr w|
|000012d0| 69 6e 64 6f 77 20 29 3b | 0d 76 6f 69 64 20 44 6f |indow );|.void Do|
|000012e0| 41 63 74 69 76 61 74 65 | 28 20 57 69 6e 64 6f 77 |Activate|( Window|
|000012f0| 50 74 72 20 77 69 6e 64 | 6f 77 2c 20 42 6f 6f 6c |Ptr wind|ow, Bool|
|00001300| 65 61 6e 20 62 65 63 6f | 6d 69 6e 67 41 63 74 69 |ean beco|mingActi|
|00001310| 76 65 20 29 3b 0d 76 6f | 69 64 20 44 6f 43 6f 6e |ve );.vo|id DoCon|
|00001320| 74 65 6e 74 43 6c 69 63 | 6b 28 20 57 69 6e 64 6f |tentClic|k( Windo|
|00001330| 77 50 74 72 20 77 69 6e | 64 6f 77 20 29 3b 0d 76 |wPtr win|dow );.v|
|00001340| 6f 69 64 20 44 72 61 77 | 57 69 6e 64 6f 77 28 20 |oid Draw|Window( |
|00001350| 57 69 6e 64 6f 77 50 74 | 72 20 77 69 6e 64 6f 77 |WindowPt|r window|
|00001360| 20 29 3b 0d 76 6f 69 64 | 20 41 64 6a 75 73 74 4d | );.void| AdjustM|
|00001370| 65 6e 75 73 28 20 76 6f | 69 64 20 29 3b 0d 76 6f |enus( vo|id );.vo|
|00001380| 69 64 20 44 6f 4d 65 6e | 75 43 6f 6d 6d 61 6e 64 |id DoMen|uCommand|
|00001390| 28 20 6c 6f 6e 67 20 6d | 65 6e 75 52 65 73 75 6c |( long m|enuResul|
|000013a0| 74 20 29 3b 0d 76 6f 69 | 64 20 53 65 74 4c 69 67 |t );.voi|d SetLig|
|000013b0| 68 74 28 20 57 69 6e 64 | 6f 77 50 74 72 20 77 69 |ht( Wind|owPtr wi|
|000013c0| 6e 64 6f 77 2c 20 42 6f | 6f 6c 65 61 6e 20 6e 65 |ndow, Bo|olean ne|
|000013d0| 77 53 74 6f 70 70 65 64 | 20 29 3b 0d 42 6f 6f 6c |wStopped| );.Bool|
|000013e0| 65 61 6e 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f |ean DoCl|oseWindo|
|000013f0| 77 28 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |w( Windo|wPtr win|
|00001400| 64 6f 77 20 29 3b 0d 76 | 6f 69 64 20 54 65 72 6d |dow );.v|oid Term|
|00001410| 69 6e 61 74 65 28 20 76 | 6f 69 64 20 29 3b 0d 76 |inate( v|oid );.v|
|00001420| 6f 69 64 20 49 6e 69 74 | 69 61 6c 69 7a 65 28 20 |oid Init|ialize( |
|00001430| 76 6f 69 64 20 29 3b 0d | 42 6f 6f 6c 65 61 6e 20 |void );.|Boolean |
|00001440| 47 6f 47 65 74 52 65 63 | 74 28 20 73 68 6f 72 74 |GoGetRec|t( short|
|00001450| 20 72 65 63 74 49 44 2c | 20 52 65 63 74 20 2a 74 | rectID,| Rect *t|
|00001460| 68 65 52 65 63 74 20 29 | 3b 0d 76 6f 69 64 20 46 |heRect )|;.void F|
|00001470| 6f 72 63 65 45 6e 76 69 | 72 6f 6e 73 28 20 76 6f |orceEnvi|rons( vo|
|00001480| 69 64 20 29 3b 0d 42 6f | 6f 6c 65 61 6e 20 49 73 |id );.Bo|olean Is|
|00001490| 41 70 70 57 69 6e 64 6f | 77 28 20 57 69 6e 64 6f |AppWindo|w( Windo|
|000014a0| 77 50 74 72 20 77 69 6e | 64 6f 77 20 29 3b 0d 42 |wPtr win|dow );.B|
|000014b0| 6f 6f 6c 65 61 6e 20 49 | 73 44 41 57 69 6e 64 6f |oolean I|sDAWindo|
|000014c0| 77 28 20 57 69 6e 64 6f | 77 50 74 72 20 77 69 6e |w( Windo|wPtr win|
|000014d0| 64 6f 77 20 29 3b 0d 42 | 6f 6f 6c 65 61 6e 20 54 |dow );.B|oolean T|
|000014e0| 72 61 70 41 76 61 69 6c | 61 62 6c 65 28 20 73 68 |rapAvail|able( sh|
|000014f0| 6f 72 74 20 74 4e 75 6d | 62 65 72 2c 20 54 72 61 |ort tNum|ber, Tra|
|00001500| 70 54 79 70 65 20 74 54 | 79 70 65 20 29 3b 0d 76 |pType tT|ype );.v|
|00001510| 6f 69 64 20 41 6c 65 72 | 74 55 73 65 72 28 20 76 |oid Aler|tUser( v|
|00001520| 6f 69 64 20 29 3b 0d 0d | 0d 2f 2a 20 44 65 66 69 |oid );..|./* Defi|
|00001530| 6e 65 20 48 69 57 72 64 | 20 61 6e 64 20 4c 6f 57 |ne HiWrd| and LoW|
|00001540| 72 64 20 6d 61 63 72 6f | 73 20 66 6f 72 20 65 66 |rd macro|s for ef|
|00001550| 66 69 63 69 65 6e 63 79 | 2e 20 2a 2f 0d 23 64 65 |ficiency|. */.#de|
|00001560| 66 69 6e 65 20 48 69 57 | 72 64 28 61 4c 6f 6e 67 |fine HiW|rd(aLong|
|00001570| 29 09 28 28 28 61 4c 6f | 6e 67 29 20 3e 3e 20 31 |).(((aLo|ng) >> 1|
|00001580| 36 29 20 26 20 30 78 46 | 46 46 46 29 0d 23 64 65 |6) & 0xF|FFF).#de|
|00001590| 66 69 6e 65 20 4c 6f 57 | 72 64 28 61 4c 6f 6e 67 |fine LoW|rd(aLong|
|000015a0| 29 09 28 28 61 4c 6f 6e | 67 29 20 26 20 30 78 46 |).((aLon|g) & 0xF|
|000015b0| 46 46 46 29 0d 0d 2f 2a | 20 44 65 66 69 6e 65 20 |FFF)../*| Define |
|000015c0| 54 6f 70 4c 65 66 74 20 | 61 6e 64 20 42 6f 74 52 |TopLeft |and BotR|
|000015d0| 69 67 68 74 20 6d 61 63 | 72 6f 73 20 66 6f 72 20 |ight mac|ros for |
|000015e0| 63 6f 6e 76 65 6e 69 65 | 6e 63 65 2e 20 4e 6f 74 |convenie|nce. Not|
|000015f0| 69 63 65 20 74 68 65 20 | 69 6d 70 6c 69 63 69 74 |ice the |implicit|
|00001600| 0d 20 20 20 64 65 70 65 | 6e 64 65 6e 63 79 20 6f |. depe|ndency o|
|00001610| 6e 20 74 68 65 20 6f 72 | 64 65 72 69 6e 67 20 6f |n the or|dering o|
|00001620| 66 20 66 69 65 6c 64 73 | 20 77 69 74 68 69 6e 20 |f fields| within |
|00001630| 61 20 52 65 63 74 20 2a | 2f 0d 23 64 65 66 69 6e |a Rect *|/.#defin|
|00001640| 65 20 54 6f 70 4c 65 66 | 74 28 61 52 65 63 74 29 |e TopLef|t(aRect)|
|00001650| 09 28 2a 20 28 50 6f 69 | 6e 74 20 2a 29 20 26 28 |.(* (Poi|nt *) &(|
|00001660| 61 52 65 63 74 29 2e 74 | 6f 70 29 0d 23 64 65 66 |aRect).t|op).#def|
|00001670| 69 6e 65 20 42 6f 74 52 | 69 67 68 74 28 61 52 65 |ine BotR|ight(aRe|
|00001680| 63 74 29 09 28 2a 20 28 | 50 6f 69 6e 74 20 2a 29 |ct).(* (|Point *)|
|00001690| 20 26 28 61 52 65 63 74 | 29 2e 62 6f 74 74 6f 6d | &(aRect|).bottom|
|000016a0| 29 0d 0d 0d 65 78 74 65 | 72 6e 20 76 6f 69 64 20 |)...exte|rn void |
|000016b0| 5f 44 61 74 61 49 6e 69 | 74 28 29 3b 0d 0d 2f 2a |_DataIni|t();../*|
|000016c0| 20 54 68 69 73 20 72 6f | 75 74 69 6e 65 20 69 73 | This ro|utine is|
|000016d0| 20 70 61 72 74 20 6f 66 | 20 74 68 65 20 4d 50 57 | part of| the MPW|
|000016e0| 20 72 75 6e 74 69 6d 65 | 20 6c 69 62 72 61 72 79 | runtime| library|
|000016f0| 2e 20 54 68 69 73 20 65 | 78 74 65 72 6e 61 6c 0d |. This e|xternal.|
|00001700| 20 20 20 72 65 66 65 72 | 65 6e 63 65 20 74 6f 20 | refer|ence to |
|00001710| 69 74 20 69 73 20 64 6f | 6e 65 20 73 6f 20 74 68 |it is do|ne so th|
|00001720| 61 74 20 77 65 20 63 61 | 6e 20 75 6e 6c 6f 61 64 |at we ca|n unload|
|00001730| 20 69 74 73 20 73 65 67 | 6d 65 6e 74 2c 20 25 41 | its seg|ment, %A|
|00001740| 35 49 6e 69 74 2e 20 2a | 2f 0d 0d 0d 23 70 72 61 |5Init. *|/...#pra|
|00001750| 67 6d 61 20 73 65 67 6d | 65 6e 74 20 4d 61 69 6e |gma segm|ent Main|
|00001760| 0d 6d 61 69 6e 28 29 0d | 7b 0d 09 55 6e 6c 6f 61 |.main().|{..Unloa|
|00001770| 64 53 65 67 28 28 50 74 | 72 29 20 5f 44 61 74 61 |dSeg((Pt|r) _Data|
|00001780| 49 6e 69 74 29 3b 09 09 | 2f 2a 20 6e 6f 74 65 20 |Init);..|/* note |
|00001790| 74 68 61 74 20 5f 44 61 | 74 61 49 6e 69 74 20 6d |that _Da|taInit m|
|000017a0| 75 73 74 20 6e 6f 74 20 | 62 65 20 69 6e 20 4d 61 |ust not |be in Ma|
|000017b0| 69 6e 21 20 2a 2f 0d 09 | 0d 09 2f 2a 20 31 2e 30 |in! */..|../* 1.0|
|000017c0| 31 20 2d 20 63 61 6c 6c | 20 74 6f 20 46 6f 72 63 |1 - call| to Forc|
|000017d0| 65 45 6e 76 69 72 6f 6e | 73 20 72 65 6d 6f 76 65 |eEnviron|s remove|
|000017e0| 64 20 2a 2f 0d 09 0d 09 | 2f 2a 09 49 66 20 79 6f |d */....|/*.If yo|
|000017f0| 75 20 68 61 76 65 20 73 | 74 61 63 6b 20 72 65 71 |u have s|tack req|
|00001800| 75 69 72 65 6d 65 6e 74 | 73 20 74 68 61 74 20 64 |uirement|s that d|
|00001810| 69 66 66 65 72 20 66 72 | 6f 6d 20 74 68 65 20 64 |iffer fr|om the d|
|00001820| 65 66 61 75 6c 74 2c 0d | 09 09 74 68 65 6e 20 79 |efault,.|..then y|
|00001830| 6f 75 20 63 6f 75 6c 64 | 20 75 73 65 20 53 65 74 |ou could| use Set|
|00001840| 41 70 70 6c 4c 69 6d 69 | 74 20 74 6f 20 69 6e 63 |ApplLimi|t to inc|
|00001850| 72 65 61 73 65 20 53 74 | 61 63 6b 53 70 61 63 65 |rease St|ackSpace|
|00001860| 20 61 74 20 0d 09 09 74 | 68 69 73 20 70 6f 69 6e | at ...t|his poin|
|00001870| 74 2c 20 62 65 66 6f 72 | 65 20 63 61 6c 6c 69 6e |t, befor|e callin|
|00001880| 67 20 4d 61 78 41 70 70 | 6c 5a 6f 6e 65 2e 20 2a |g MaxApp|lZone. *|
|00001890| 2f 0d 09 4d 61 78 41 70 | 70 6c 5a 6f 6e 65 28 29 |/..MaxAp|plZone()|
|000018a0| 3b 09 09 09 09 09 2f 2a | 20 65 78 70 61 6e 64 20 |;...../*| expand |
|000018b0| 74 68 65 20 68 65 61 70 | 20 73 6f 20 63 6f 64 65 |the heap| so code|
|000018c0| 20 73 65 67 6d 65 6e 74 | 73 20 6c 6f 61 64 20 61 | segment|s load a|
|000018d0| 74 20 74 68 65 20 74 6f | 70 20 2a 2f 0d 0d 09 49 |t the to|p */...I|
|000018e0| 6e 69 74 69 61 6c 69 7a | 65 28 29 3b 09 09 09 09 |nitializ|e();....|
|000018f0| 09 2f 2a 20 69 6e 69 74 | 69 61 6c 69 7a 65 20 74 |./* init|ialize t|
|00001900| 68 65 20 70 72 6f 67 72 | 61 6d 20 2a 2f 0d 09 55 |he progr|am */..U|
|00001910| 6e 6c 6f 61 64 53 65 67 | 28 28 50 74 72 29 20 49 |nloadSeg|((Ptr) I|
|00001920| 6e 69 74 69 61 6c 69 7a | 65 29 3b 09 2f 2a 20 6e |nitializ|e);./* n|
|00001930| 6f 74 65 20 74 68 61 74 | 20 49 6e 69 74 69 61 6c |ote that| Initial|
|00001940| 69 7a 65 20 6d 75 73 74 | 20 6e 6f 74 20 62 65 20 |ize must| not be |
|00001950| 69 6e 20 4d 61 69 6e 21 | 20 2a 2f 0d 0d 09 45 76 |in Main!| */...Ev|
|00001960| 65 6e 74 4c 6f 6f 70 28 | 29 3b 09 09 09 09 09 2f |entLoop(|);...../|
|00001970| 2a 20 63 61 6c 6c 20 74 | 68 65 20 6d 61 69 6e 20 |* call t|he main |
|00001980| 65 76 65 6e 74 20 6c 6f | 6f 70 20 2a 2f 0d 7d 0d |event lo|op */.}.|
|00001990| 0d 0d 2f 2a 09 47 65 74 | 20 65 76 65 6e 74 73 20 |../*.Get| events |
|000019a0| 66 6f 72 65 76 65 72 2c | 20 61 6e 64 20 68 61 6e |forever,| and han|
|000019b0| 64 6c 65 20 74 68 65 6d | 20 62 79 20 63 61 6c 6c |dle them| by call|
|000019c0| 69 6e 67 20 44 6f 45 76 | 65 6e 74 2e 0d 09 47 65 |ing DoEv|ent...Ge|
|000019d0| 74 20 74 68 65 20 65 76 | 65 6e 74 73 20 62 79 20 |t the ev|ents by |
|000019e0| 63 61 6c 6c 69 6e 67 20 | 57 61 69 74 4e 65 78 74 |calling |WaitNext|
|000019f0| 45 76 65 6e 74 2c 20 69 | 66 20 69 74 27 73 20 61 |Event, i|f it's a|
|00001a00| 76 61 69 6c 61 62 6c 65 | 2c 20 6f 74 68 65 72 77 |vailable|, otherw|
|00001a10| 69 73 65 0d 09 62 79 20 | 63 61 6c 6c 69 6e 67 20 |ise..by |calling |
|00001a20| 47 65 74 4e 65 78 74 45 | 76 65 6e 74 2e 20 41 6c |GetNextE|vent. Al|
|00001a30| 73 6f 20 63 61 6c 6c 20 | 41 64 6a 75 73 74 43 75 |so call |AdjustCu|
|00001a40| 72 73 6f 72 20 65 61 63 | 68 20 74 69 6d 65 20 74 |rsor eac|h time t|
|00001a50| 68 72 6f 75 67 68 20 74 | 68 65 20 6c 6f 6f 70 2e |hrough t|he loop.|
|00001a60| 20 2a 2f 0d 0d 23 70 72 | 61 67 6d 61 20 73 65 67 | */..#pr|agma seg|
|00001a70| 6d 65 6e 74 20 4d 61 69 | 6e 0d 76 6f 69 64 20 45 |ment Mai|n.void E|
|00001a80| 76 65 6e 74 4c 6f 6f 70 | 28 29 0d 7b 0d 09 52 67 |ventLoop|().{..Rg|
|00001a90| 6e 48 61 6e 64 6c 65 09 | 63 75 72 73 6f 72 52 67 |nHandle.|cursorRg|
|00001aa0| 6e 3b 0d 09 42 6f 6f 6c | 65 61 6e 09 09 67 6f 74 |n;..Bool|ean..got|
|00001ab0| 45 76 65 6e 74 3b 0d 09 | 45 76 65 6e 74 52 65 63 |Event;..|EventRec|
|00001ac0| 6f 72 64 09 65 76 65 6e | 74 3b 0d 09 50 6f 69 6e |ord.even|t;..Poin|
|00001ad0| 74 09 09 6d 6f 75 73 65 | 3b 0d 0d 09 63 75 72 73 |t..mouse|;...curs|
|00001ae0| 6f 72 52 67 6e 20 3d 20 | 4e 65 77 52 67 6e 28 29 |orRgn = |NewRgn()|
|00001af0| 3b 09 09 09 2f 2a 20 77 | 65 d5 6c 6c 20 70 61 73 |;.../* w|e.ll pas|
|00001b00| 73 20 57 4e 45 20 61 6e | 20 65 6d 70 74 79 20 72 |s WNE an| empty r|
|00001b10| 65 67 69 6f 6e 20 74 68 | 65 20 31 73 74 20 74 69 |egion th|e 1st ti|
|00001b20| 6d 65 20 74 68 72 75 20 | 2a 2f 0d 09 64 6f 20 7b |me thru |*/..do {|
|00001b30| 0d 09 09 2f 2a 20 75 73 | 65 20 57 4e 45 20 69 66 |.../* us|e WNE if|
|00001b40| 20 69 74 20 69 73 20 61 | 76 61 69 6c 61 62 6c 65 | it is a|vailable|
|00001b50| 20 2a 2f 0d 09 09 69 66 | 20 28 20 67 48 61 73 57 | */...if| ( gHasW|
|00001b60| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 20 29 20 7b |aitNextE|vent ) {|
|00001b70| 0d 09 09 09 47 65 74 47 | 6c 6f 62 61 6c 4d 6f 75 |....GetG|lobalMou|
|00001b80| 73 65 28 26 6d 6f 75 73 | 65 29 3b 0d 09 09 09 41 |se(&mous|e);....A|
|00001b90| 64 6a 75 73 74 43 75 72 | 73 6f 72 28 6d 6f 75 73 |djustCur|sor(mous|
|00001ba0| 65 2c 20 63 75 72 73 6f | 72 52 67 6e 29 3b 0d 09 |e, curso|rRgn);..|
|00001bb0| 09 09 67 6f 74 45 76 65 | 6e 74 20 3d 20 57 61 69 |..gotEve|nt = Wai|
|00001bc0| 74 4e 65 78 74 45 76 65 | 6e 74 28 65 76 65 72 79 |tNextEve|nt(every|
|00001bd0| 45 76 65 6e 74 2c 20 26 | 65 76 65 6e 74 2c 20 4d |Event, &|event, M|
|00001be0| 41 58 4c 4f 4e 47 2c 20 | 63 75 72 73 6f 72 52 67 |AXLONG, |cursorRg|
|00001bf0| 6e 29 3b 0d 09 09 7d 0d | 09 09 65 6c 73 65 20 7b |n);...}.|..else {|
|00001c00| 0d 09 09 09 53 79 73 74 | 65 6d 54 61 73 6b 28 29 |....Syst|emTask()|
|00001c10| 3b 0d 09 09 09 67 6f 74 | 45 76 65 6e 74 20 3d 20 |;....got|Event = |
|00001c20| 47 65 74 4e 65 78 74 45 | 76 65 6e 74 28 65 76 65 |GetNextE|vent(eve|
|00001c30| 72 79 45 76 65 6e 74 2c | 20 26 65 76 65 6e 74 29 |ryEvent,| &event)|
|00001c40| 3b 0d 09 09 7d 0d 09 09 | 69 66 20 28 20 67 6f 74 |;...}...|if ( got|
|00001c50| 45 76 65 6e 74 20 29 20 | 7b 0d 09 09 09 2f 2a 20 |Event ) |{..../* |
|00001c60| 6d 61 6b 65 20 73 75 72 | 65 20 77 65 20 68 61 76 |make sur|e we hav|
|00001c70| 65 20 74 68 65 20 72 69 | 67 68 74 20 63 75 72 73 |e the ri|ght curs|
|00001c80| 6f 72 20 62 65 66 6f 72 | 65 20 68 61 6e 64 6c 69 |or befor|e handli|
|00001c90| 6e 67 20 74 68 65 20 65 | 76 65 6e 74 20 2a 2f 0d |ng the e|vent */.|
|00001ca0| 09 09 09 41 64 6a 75 73 | 74 43 75 72 73 6f 72 28 |...Adjus|tCursor(|
|00001cb0| 65 76 65 6e 74 2e 77 68 | 65 72 65 2c 20 63 75 72 |event.wh|ere, cur|
|00001cc0| 73 6f 72 52 67 6e 29 3b | 0d 09 09 09 44 6f 45 76 |sorRgn);|....DoEv|
|00001cd0| 65 6e 74 28 26 65 76 65 | 6e 74 29 3b 0d 09 09 7d |ent(&eve|nt);...}|
|00001ce0| 0d 09 09 2f 2a 09 49 66 | 20 79 6f 75 20 61 72 65 |.../*.If| you are|
|00001cf0| 20 75 73 69 6e 67 20 6d | 6f 64 65 6c 65 73 73 20 | using m|odeless |
|00001d00| 64 69 61 6c 6f 67 73 20 | 74 68 61 74 20 68 61 76 |dialogs |that hav|
|00001d10| 65 20 65 64 69 74 54 65 | 78 74 20 69 74 65 6d 73 |e editTe|xt items|
|00001d20| 2c 0d 09 09 09 79 6f 75 | 20 77 69 6c 6c 20 77 61 |,....you| will wa|
|00001d30| 6e 74 20 74 6f 20 63 61 | 6c 6c 20 49 73 44 69 61 |nt to ca|ll IsDia|
|00001d40| 6c 6f 67 45 76 65 6e 74 | 20 74 6f 20 67 69 76 65 |logEvent| to give|
|00001d50| 20 74 68 65 20 63 61 72 | 65 74 20 61 20 63 68 61 | the car|et a cha|
|00001d60| 6e 63 65 0d 09 09 09 74 | 6f 20 62 6c 69 6e 6b 2c |nce....t|o blink,|
|00001d70| 20 65 76 65 6e 20 69 66 | 20 57 4e 45 2f 47 4e 45 | even if| WNE/GNE|
|00001d80| 20 72 65 74 75 72 6e 65 | 64 20 46 41 4c 53 45 2e | returne|d FALSE.|
|00001d90| 20 48 6f 77 65 76 65 72 | 2c 20 63 68 65 63 6b 20 | However|, check |
|00001da0| 46 72 6f 6e 74 57 69 6e | 64 6f 77 0d 09 09 09 66 |FrontWin|dow....f|
|00001db0| 6f 72 20 61 20 6e 6f 6e | 2d 4e 49 4c 20 76 61 6c |or a non|-NIL val|
|00001dc0| 75 65 20 62 65 66 6f 72 | 65 20 63 61 6c 6c 69 6e |ue befor|e callin|
|00001dd0| 67 20 49 73 44 69 61 6c | 6f 67 45 76 65 6e 74 2e |g IsDial|ogEvent.|
|00001de0| 20 2a 2f 0d 09 7d 20 77 | 68 69 6c 65 20 28 20 74 | */..} w|hile ( t|
|00001df0| 72 75 65 20 29 3b 09 2f | 2a 20 6c 6f 6f 70 20 66 |rue );./|* loop f|
|00001e00| 6f 72 65 76 65 72 3b 20 | 77 65 20 71 75 69 74 20 |orever; |we quit |
|00001e10| 76 69 61 20 45 78 69 74 | 54 6f 53 68 65 6c 6c 20 |via Exit|ToShell |
|00001e20| 2a 2f 0d 7d 20 2f 2a 45 | 76 65 6e 74 4c 6f 6f 70 |*/.} /*E|ventLoop|
|00001e30| 2a 2f 0d 0d 0d 2f 2a 20 | 44 6f 20 74 68 65 20 72 |*/.../* |Do the r|
|00001e40| 69 67 68 74 20 74 68 69 | 6e 67 20 66 6f 72 20 61 |ight thi|ng for a|
|00001e50| 6e 20 65 76 65 6e 74 2e | 20 44 65 74 65 72 6d 69 |n event.| Determi|
|00001e60| 6e 65 20 77 68 61 74 20 | 6b 69 6e 64 20 6f 66 20 |ne what |kind of |
|00001e70| 65 76 65 6e 74 20 69 74 | 20 69 73 2c 20 61 6e 64 |event it| is, and|
|00001e80| 20 63 61 6c 6c 0d 20 74 | 68 65 20 61 70 70 72 6f | call. t|he appro|
|00001e90| 70 72 69 61 74 65 20 72 | 6f 75 74 69 6e 65 73 2e |priate r|outines.|
|00001ea0| 20 2a 2f 0d 0d 23 70 72 | 61 67 6d 61 20 73 65 67 | */..#pr|agma seg|
|00001eb0| 6d 65 6e 74 20 4d 61 69 | 6e 0d 76 6f 69 64 20 44 |ment Mai|n.void D|
|00001ec0| 6f 45 76 65 6e 74 28 65 | 76 65 6e 74 29 0d 09 45 |oEvent(e|vent)..E|
|00001ed0| 76 65 6e 74 52 65 63 6f | 72 64 09 2a 65 76 65 6e |ventReco|rd.*even|
|00001ee0| 74 3b 0d 7b 0d 09 73 68 | 6f 72 74 09 09 70 61 72 |t;.{..sh|ort..par|
|00001ef0| 74 2c 20 65 72 72 3b 0d | 09 57 69 6e 64 6f 77 50 |t, err;.|.WindowP|
|00001f00| 74 72 09 77 69 6e 64 6f | 77 3b 0d 09 42 6f 6f 6c |tr.windo|w;..Bool|
|00001f10| 65 61 6e 09 09 68 69 74 | 3b 0d 09 63 68 61 72 09 |ean..hit|;..char.|
|00001f20| 09 6b 65 79 3b 0d 09 50 | 6f 69 6e 74 09 09 61 50 |.key;..P|oint..aP|
|00001f30| 6f 69 6e 74 3b 0d 0d 09 | 73 77 69 74 63 68 20 28 |oint;...|switch (|
|00001f40| 20 65 76 65 6e 74 2d 3e | 77 68 61 74 20 29 20 7b | event->|what ) {|
|00001f50| 0d 09 09 63 61 73 65 20 | 6d 6f 75 73 65 44 6f 77 |...case |mouseDow|
|00001f60| 6e 3a 0d 09 09 09 70 61 | 72 74 20 3d 20 46 69 6e |n:....pa|rt = Fin|
|00001f70| 64 57 69 6e 64 6f 77 28 | 65 76 65 6e 74 2d 3e 77 |dWindow(|event->w|
|00001f80| 68 65 72 65 2c 20 26 77 | 69 6e 64 6f 77 29 3b 0d |here, &w|indow);.|
|00001f90| 09 09 09 73 77 69 74 63 | 68 20 28 20 70 61 72 74 |...switc|h ( part|
|00001fa0| 20 29 20 7b 0d 09 09 09 | 09 63 61 73 65 20 69 6e | ) {....|.case in|
|00001fb0| 4d 65 6e 75 42 61 72 3a | 09 09 09 09 2f 2a 20 70 |MenuBar:|..../* p|
|00001fc0| 72 6f 63 65 73 73 20 61 | 20 6d 6f 75 73 65 20 6d |rocess a| mouse m|
|00001fd0| 65 6e 75 20 63 6f 6d 6d | 61 6e 64 20 28 69 66 20 |enu comm|and (if |
|00001fe0| 61 6e 79 29 20 2a 2f 0d | 09 09 09 09 09 41 64 6a |any) */.|.....Adj|
|00001ff0| 75 73 74 4d 65 6e 75 73 | 28 29 3b 0d 09 09 09 09 |ustMenus|();.....|
|00002000| 09 44 6f 4d 65 6e 75 43 | 6f 6d 6d 61 6e 64 28 4d |.DoMenuC|ommand(M|
|00002010| 65 6e 75 53 65 6c 65 63 | 74 28 65 76 65 6e 74 2d |enuSelec|t(event-|
|00002020| 3e 77 68 65 72 65 29 29 | 3b 0d 09 09 09 09 09 62 |>where))|;......b|
|00002030| 72 65 61 6b 3b 0d 09 09 | 09 09 63 61 73 65 20 69 |reak;...|..case i|
|00002040| 6e 53 79 73 57 69 6e 64 | 6f 77 3a 09 09 09 2f 2a |nSysWind|ow:.../*|
|00002050| 20 6c 65 74 20 74 68 65 | 20 73 79 73 74 65 6d 20 | let the| system |
|00002060| 68 61 6e 64 6c 65 20 74 | 68 65 20 6d 6f 75 73 65 |handle t|he mouse|
|00002070| 44 6f 77 6e 20 2a 2f 0d | 09 09 09 09 09 53 79 73 |Down */.|.....Sys|
|00002080| 74 65 6d 43 6c 69 63 6b | 28 65 76 65 6e 74 2c 20 |temClick|(event, |
|00002090| 77 69 6e 64 6f 77 29 3b | 0d 09 09 09 09 09 62 72 |window);|......br|
|000020a0| 65 61 6b 3b 0d 09 09 09 | 09 63 61 73 65 20 69 6e |eak;....|.case in|
|000020b0| 43 6f 6e 74 65 6e 74 3a | 0d 09 09 09 09 09 69 66 |Content:|......if|
|000020c0| 20 28 20 77 69 6e 64 6f | 77 20 21 3d 20 46 72 6f | ( windo|w != Fro|
|000020d0| 6e 74 57 69 6e 64 6f 77 | 28 29 20 29 20 7b 0d 09 |ntWindow|() ) {..|
|000020e0| 09 09 09 09 09 53 65 6c | 65 63 74 57 69 6e 64 6f |.....Sel|ectWindo|
|000020f0| 77 28 77 69 6e 64 6f 77 | 29 3b 0d 09 09 09 09 09 |w(window|);......|
|00002100| 09 2f 2a 44 6f 45 76 65 | 6e 74 28 65 76 65 6e 74 |./*DoEve|nt(event|
|00002110| 29 3b 2a 2f 09 2f 2a 20 | 75 73 65 20 74 68 69 73 |);*/./* |use this|
|00002120| 20 6c 69 6e 65 20 66 6f | 72 20 22 64 6f 20 66 69 | line fo|r "do fi|
|00002130| 72 73 74 20 63 6c 69 63 | 6b 22 20 2a 2f 0d 09 09 |rst clic|k" */...|
|00002140| 09 09 09 7d 20 65 6c 73 | 65 0d 09 09 09 09 09 09 |...} els|e.......|
|00002150| 44 6f 43 6f 6e 74 65 6e | 74 43 6c 69 63 6b 28 77 |DoConten|tClick(w|
|00002160| 69 6e 64 6f 77 29 3b 0d | 09 09 09 09 09 62 72 65 |indow);.|.....bre|
|00002170| 61 6b 3b 0d 09 09 09 09 | 63 61 73 65 20 69 6e 44 |ak;.....|case inD|
|00002180| 72 61 67 3a 09 09 09 09 | 2f 2a 20 70 61 73 73 20 |rag:....|/* pass |
|00002190| 73 63 72 65 65 6e 42 69 | 74 73 2e 62 6f 75 6e 64 |screenBi|ts.bound|
|000021a0| 73 20 74 6f 20 67 65 74 | 20 61 6c 6c 20 67 44 65 |s to get| all gDe|
|000021b0| 76 69 63 65 73 20 2a 2f | 0d 09 09 09 09 09 44 72 |vices */|......Dr|
|000021c0| 61 67 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 2c |agWindow|(window,|
|000021d0| 20 65 76 65 6e 74 2d 3e | 77 68 65 72 65 2c 20 26 | event->|where, &|
|000021e0| 71 64 2e 73 63 72 65 65 | 6e 42 69 74 73 2e 62 6f |qd.scree|nBits.bo|
|000021f0| 75 6e 64 73 29 3b 0d 09 | 09 09 09 09 62 72 65 61 |unds);..|....brea|
|00002200| 6b 3b 0d 09 09 09 09 63 | 61 73 65 20 69 6e 47 72 |k;.....c|ase inGr|
|00002210| 6f 77 3a 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |ow:.....|.break;.|
|00002220| 09 09 09 09 63 61 73 65 | 20 69 6e 5a 6f 6f 6d 49 |....case| inZoomI|
|00002230| 6e 3a 0d 09 09 09 09 63 | 61 73 65 20 69 6e 5a 6f |n:.....c|ase inZo|
|00002240| 6f 6d 4f 75 74 3a 0d 09 | 09 09 09 09 68 69 74 20 |omOut:..|....hit |
|00002250| 3d 20 54 72 61 63 6b 42 | 6f 78 28 77 69 6e 64 6f |= TrackB|ox(windo|
|00002260| 77 2c 20 65 76 65 6e 74 | 2d 3e 77 68 65 72 65 2c |w, event|->where,|
|00002270| 20 70 61 72 74 29 3b 0d | 09 09 09 09 09 69 66 20 | part);.|.....if |
|00002280| 28 20 68 69 74 20 29 20 | 7b 0d 09 09 09 09 09 09 |( hit ) |{.......|
|00002290| 53 65 74 50 6f 72 74 28 | 77 69 6e 64 6f 77 29 3b |SetPort(|window);|
|000022a0| 09 09 09 09 2f 2a 20 74 | 68 65 20 77 69 6e 64 6f |..../* t|he windo|
|000022b0| 77 20 6d 75 73 74 20 62 | 65 20 74 68 65 20 63 75 |w must b|e the cu|
|000022c0| 72 72 65 6e 74 20 70 6f | 72 74 2e 2e 2e 20 2a 2f |rrent po|rt... */|
|000022d0| 0d 09 09 09 09 09 09 45 | 72 61 73 65 52 65 63 74 |.......E|raseRect|
|000022e0| 28 26 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 52 65 |(&window|->portRe|
|000022f0| 63 74 29 3b 09 2f 2a 20 | 62 65 63 61 75 73 65 20 |ct);./* |because |
|00002300| 6f 66 20 61 20 62 75 67 | 20 69 6e 20 5a 6f 6f 6d |of a bug| in Zoom|
|00002310| 57 69 6e 64 6f 77 20 2a | 2f 0d 09 09 09 09 09 09 |Window *|/.......|
|00002320| 5a 6f 6f 6d 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |ZoomWind|ow(windo|
|00002330| 77 2c 20 70 61 72 74 2c | 20 74 72 75 65 29 3b 09 |w, part,| true);.|
|00002340| 2f 2a 20 6e 6f 74 65 20 | 74 68 61 74 20 77 65 20 |/* note |that we |
|00002350| 69 6e 76 61 6c 69 64 61 | 74 65 20 61 6e 64 20 65 |invalida|te and e|
|00002360| 72 61 73 65 2e 2e 2e 20 | 2a 2f 0d 09 09 09 09 09 |rase... |*/......|
|00002370| 09 49 6e 76 61 6c 52 65 | 63 74 28 26 77 69 6e 64 |.InvalRe|ct(&wind|
|00002380| 6f 77 2d 3e 70 6f 72 74 | 52 65 63 74 29 3b 09 2f |ow->port|Rect);./|
|00002390| 2a 20 74 6f 20 6d 61 6b | 65 20 74 68 69 6e 67 73 |* to mak|e things|
|000023a0| 20 6c 6f 6f 6b 20 62 65 | 74 74 65 72 20 6f 6e 2d | look be|tter on-|
|000023b0| 73 63 72 65 65 6e 20 2a | 2f 0d 09 09 09 09 09 7d |screen *|/......}|
|000023c0| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|000023d0| 7d 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 63 61 |}....bre|ak;...ca|
|000023e0| 73 65 20 6b 65 79 44 6f | 77 6e 3a 0d 09 09 63 61 |se keyDo|wn:...ca|
|000023f0| 73 65 20 61 75 74 6f 4b | 65 79 3a 09 09 09 09 09 |se autoK|ey:.....|
|00002400| 09 2f 2a 20 63 68 65 63 | 6b 20 66 6f 72 20 6d 65 |./* chec|k for me|
|00002410| 6e 75 6b 65 79 20 65 71 | 75 69 76 61 6c 65 6e 74 |nukey eq|uivalent|
|00002420| 73 20 2a 2f 0d 09 09 09 | 6b 65 79 20 3d 20 65 76 |s */....|key = ev|
|00002430| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 20 26 20 63 |ent->mes|sage & c|
|00002440| 68 61 72 43 6f 64 65 4d | 61 73 6b 3b 0d 09 09 09 |harCodeM|ask;....|
|00002450| 69 66 20 28 20 65 76 65 | 6e 74 2d 3e 6d 6f 64 69 |if ( eve|nt->modi|
|00002460| 66 69 65 72 73 20 26 20 | 63 6d 64 4b 65 79 20 29 |fiers & |cmdKey )|
|00002470| 09 09 09 2f 2a 20 43 6f | 6d 6d 61 6e 64 20 6b 65 |.../* Co|mmand ke|
|00002480| 79 20 64 6f 77 6e 20 2a | 2f 0d 09 09 09 09 69 66 |y down *|/.....if|
|00002490| 20 28 20 65 76 65 6e 74 | 2d 3e 77 68 61 74 20 3d | ( event|->what =|
|000024a0| 3d 20 6b 65 79 44 6f 77 | 6e 20 29 20 7b 0d 09 09 |= keyDow|n ) {...|
|000024b0| 09 09 09 41 64 6a 75 73 | 74 4d 65 6e 75 73 28 29 |...Adjus|tMenus()|
|000024c0| 3b 09 09 09 09 09 09 2f | 2a 20 65 6e 61 62 6c 65 |;....../|* enable|
|000024d0| 2f 64 69 73 61 62 6c 65 | 2f 63 68 65 63 6b 20 6d |/disable|/check m|
|000024e0| 65 6e 75 20 69 74 65 6d | 73 20 70 72 6f 70 65 72 |enu item|s proper|
|000024f0| 6c 79 20 2a 2f 0d 09 09 | 09 09 09 44 6f 4d 65 6e |ly */...|...DoMen|
|00002500| 75 43 6f 6d 6d 61 6e 64 | 28 4d 65 6e 75 4b 65 79 |uCommand|(MenuKey|
|00002510| 28 6b 65 79 29 29 3b 0d | 09 09 09 09 7d 0d 09 09 |(key));.|....}...|
|00002520| 09 62 72 65 61 6b 3b 0d | 09 09 63 61 73 65 20 61 |.break;.|..case a|
|00002530| 63 74 69 76 61 74 65 45 | 76 74 3a 0d 09 09 09 44 |ctivateE|vt:....D|
|00002540| 6f 41 63 74 69 76 61 74 | 65 28 28 57 69 6e 64 6f |oActivat|e((Windo|
|00002550| 77 50 74 72 29 20 65 76 | 65 6e 74 2d 3e 6d 65 73 |wPtr) ev|ent->mes|
|00002560| 73 61 67 65 2c 20 28 65 | 76 65 6e 74 2d 3e 6d 6f |sage, (e|vent->mo|
|00002570| 64 69 66 69 65 72 73 20 | 26 20 61 63 74 69 76 65 |difiers |& active|
|00002580| 46 6c 61 67 29 20 21 3d | 20 30 29 3b 0d 09 09 09 |Flag) !=| 0);....|
|00002590| 62 72 65 61 6b 3b 0d 09 | 09 63 61 73 65 20 75 70 |break;..|.case up|
|000025a0| 64 61 74 65 45 76 74 3a | 0d 09 09 09 44 6f 55 70 |dateEvt:|....DoUp|
|000025b0| 64 61 74 65 28 28 57 69 | 6e 64 6f 77 50 74 72 29 |date((Wi|ndowPtr)|
|000025c0| 20 65 76 65 6e 74 2d 3e | 6d 65 73 73 61 67 65 29 | event->|message)|
|000025d0| 3b 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 09 2f 2a |;....bre|ak;.../*|
|000025e0| 09 31 2e 30 31 20 2d 20 | 49 74 20 69 73 20 6e 6f |.1.01 - |It is no|
|000025f0| 74 20 61 20 62 61 64 20 | 69 64 65 61 20 74 6f 20 |t a bad |idea to |
|00002600| 61 74 20 6c 65 61 73 74 | 20 63 61 6c 6c 20 44 49 |at least| call DI|
|00002610| 42 61 64 4d 6f 75 6e 74 | 20 69 6e 20 72 65 73 70 |BadMount| in resp|
|00002620| 6f 6e 73 65 0d 09 09 09 | 74 6f 20 61 20 64 69 73 |onse....|to a dis|
|00002630| 6b 45 76 74 2c 20 73 6f | 20 74 68 61 74 20 74 68 |kEvt, so| that th|
|00002640| 65 20 75 73 65 72 20 63 | 61 6e 20 66 6f 72 6d 61 |e user c|an forma|
|00002650| 74 20 61 20 66 6c 6f 70 | 70 79 2e 20 2a 2f 0d 09 |t a flop|py. */..|
|00002660| 09 63 61 73 65 20 64 69 | 73 6b 45 76 74 3a 0d 09 |.case di|skEvt:..|
|00002670| 09 09 69 66 20 28 20 48 | 69 57 6f 72 64 28 65 76 |..if ( H|iWord(ev|
|00002680| 65 6e 74 2d 3e 6d 65 73 | 73 61 67 65 29 20 21 3d |ent->mes|sage) !=|
|00002690| 20 6e 6f 45 72 72 20 29 | 20 7b 0d 09 09 09 09 53 | noErr )| {.....S|
|000026a0| 65 74 50 74 28 26 61 50 | 6f 69 6e 74 2c 20 6b 44 |etPt(&aP|oint, kD|
|000026b0| 49 4c 65 66 74 2c 20 6b | 44 49 54 6f 70 29 3b 0d |ILeft, k|DITop);.|
|000026c0| 09 09 09 09 65 72 72 20 | 3d 20 44 49 42 61 64 4d |....err |= DIBadM|
|000026d0| 6f 75 6e 74 28 61 50 6f | 69 6e 74 2c 20 65 76 65 |ount(aPo|int, eve|
|000026e0| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 29 3b 0d 09 09 |nt->mess|age);...|
|000026f0| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |.}....br|eak;...c|
|00002700| 61 73 65 20 6b 4f 53 45 | 76 65 6e 74 3a 0d 09 09 |ase kOSE|vent:...|
|00002710| 2f 2a 09 31 2e 30 32 20 | 2d 20 6d 75 73 74 20 42 |/*.1.02 |- must B|
|00002720| 69 74 41 4e 44 20 77 69 | 74 68 20 30 78 30 46 46 |itAND wi|th 0x0FF|
|00002730| 20 74 6f 20 67 65 74 20 | 6f 6e 6c 79 20 6c 6f 77 | to get |only low|
|00002740| 20 62 79 74 65 20 2a 2f | 0d 09 09 09 73 77 69 74 | byte */|....swit|
|00002750| 63 68 20 28 28 65 76 65 | 6e 74 2d 3e 6d 65 73 73 |ch ((eve|nt->mess|
|00002760| 61 67 65 20 3e 3e 20 32 | 34 29 20 26 20 30 78 30 |age >> 2|4) & 0x0|
|00002770| 46 46 29 20 7b 09 09 2f | 2a 20 68 69 67 68 20 62 |FF) {../|* high b|
|00002780| 79 74 65 20 6f 66 20 6d | 65 73 73 61 67 65 20 2a |yte of m|essage *|
|00002790| 2f 0d 09 09 09 09 63 61 | 73 65 20 6b 53 75 73 70 |/.....ca|se kSusp|
|000027a0| 65 6e 64 52 65 73 75 6d | 65 4d 65 73 73 61 67 65 |endResum|eMessage|
|000027b0| 3a 09 09 2f 2a 20 73 75 | 73 70 65 6e 64 2f 72 65 |:../* su|spend/re|
|000027c0| 73 75 6d 65 20 69 73 20 | 61 6c 73 6f 20 61 6e 20 |sume is |also an |
|000027d0| 61 63 74 69 76 61 74 65 | 2f 64 65 61 63 74 69 76 |activate|/deactiv|
|000027e0| 61 74 65 20 2a 2f 0d 09 | 09 09 09 09 67 49 6e 42 |ate */..|....gInB|
|000027f0| 61 63 6b 67 72 6f 75 6e | 64 20 3d 20 28 65 76 65 |ackgroun|d = (eve|
|00002800| 6e 74 2d 3e 6d 65 73 73 | 61 67 65 20 26 20 6b 52 |nt->mess|age & kR|
|00002810| 65 73 75 6d 65 4d 61 73 | 6b 29 20 3d 3d 20 30 3b |esumeMas|k) == 0;|
|00002820| 0d 09 09 09 09 09 44 6f | 41 63 74 69 76 61 74 65 |......Do|Activate|
|00002830| 28 46 72 6f 6e 74 57 69 | 6e 64 6f 77 28 29 2c 20 |(FrontWi|ndow(), |
|00002840| 21 67 49 6e 42 61 63 6b | 67 72 6f 75 6e 64 29 3b |!gInBack|ground);|
|00002850| 0d 09 09 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 09 |......br|eak;....|
|00002860| 7d 0d 09 09 09 62 72 65 | 61 6b 3b 0d 09 7d 0d 7d |}....bre|ak;..}.}|
|00002870| 20 2f 2a 44 6f 45 76 65 | 6e 74 2a 2f 0d 0d 0d 2f | /*DoEve|nt*/.../|
|00002880| 2a 09 43 68 61 6e 67 65 | 20 74 68 65 20 63 75 72 |*.Change| the cur|
|00002890| 73 6f 72 27 73 20 73 68 | 61 70 65 2c 20 64 65 70 |sor's sh|ape, dep|
|000028a0| 65 6e 64 69 6e 67 20 6f | 6e 20 69 74 73 20 70 6f |ending o|n its po|
|000028b0| 73 69 74 69 6f 6e 2e 20 | 54 68 69 73 20 61 6c 73 |sition. |This als|
|000028c0| 6f 20 63 61 6c 63 75 6c | 61 74 65 73 20 74 68 65 |o calcul|ates the|
|000028d0| 20 72 65 67 69 6f 6e 0d | 09 77 68 65 72 65 20 74 | region.|.where t|
|000028e0| 68 65 20 63 75 72 72 65 | 6e 74 20 63 75 72 73 6f |he curre|nt curso|
|000028f0| 72 20 72 65 73 69 64 65 | 73 20 28 66 6f 72 20 57 |r reside|s (for W|
|00002900| 61 69 74 4e 65 78 74 45 | 76 65 6e 74 29 2e 20 49 |aitNextE|vent). I|
|00002910| 66 20 74 68 65 20 6d 6f | 75 73 65 20 69 73 20 65 |f the mo|use is e|
|00002920| 76 65 72 20 6f 75 74 73 | 69 64 65 20 6f 66 0d 09 |ver outs|ide of..|
|00002930| 74 68 61 74 20 72 65 67 | 69 6f 6e 2c 20 61 6e 20 |that reg|ion, an |
|00002940| 65 76 65 6e 74 20 77 6f | 75 6c 64 20 62 65 20 67 |event wo|uld be g|
|00002950| 65 6e 65 72 61 74 65 64 | 2c 20 63 61 75 73 69 6e |enerated|, causin|
|00002960| 67 20 74 68 69 73 20 72 | 6f 75 74 69 6e 65 20 74 |g this r|outine t|
|00002970| 6f 20 62 65 20 63 61 6c | 6c 65 64 2c 0d 09 61 6c |o be cal|led,..al|
|00002980| 6c 6f 77 69 6e 67 20 75 | 73 20 74 6f 20 63 68 61 |lowing u|s to cha|
|00002990| 6e 67 65 20 74 68 65 20 | 72 65 67 69 6f 6e 20 74 |nge the |region t|
|000029a0| 6f 20 74 68 65 20 72 65 | 67 69 6f 6e 20 74 68 65 |o the re|gion the|
|000029b0| 20 6d 6f 75 73 65 20 69 | 73 20 63 75 72 72 65 6e | mouse i|s curren|
|000029c0| 74 6c 79 20 69 6e 2e 20 | 49 66 0d 09 74 68 65 72 |tly in. |If..ther|
|000029d0| 65 20 69 73 20 6d 6f 72 | 65 20 74 6f 20 74 68 65 |e is mor|e to the|
|000029e0| 20 65 76 65 6e 74 20 74 | 68 61 6e 20 6a 75 73 74 | event t|han just|
|000029f0| 20 d2 74 68 65 20 6d 6f | 75 73 65 20 6d 6f 76 65 | .the mo|use move|
|00002a00| 64 d3 2c 20 77 65 20 67 | 65 74 20 63 61 6c 6c 65 |d., we g|et calle|
|00002a10| 64 20 62 65 66 6f 72 65 | 20 74 68 65 0d 09 65 76 |d before| the..ev|
|00002a20| 65 6e 74 20 69 73 20 70 | 72 6f 63 65 73 73 65 64 |ent is p|rocessed|
|00002a30| 20 74 6f 20 6d 61 6b 65 | 20 73 75 72 65 20 74 68 | to make| sure th|
|00002a40| 65 20 63 75 72 73 6f 72 | 20 69 73 20 74 68 65 20 |e cursor| is the |
|00002a50| 72 69 67 68 74 20 6f 6e | 65 2e 20 49 6e 20 61 6e |right on|e. In an|
|00002a60| 79 20 28 61 68 65 6d 29 | 20 65 76 65 6e 74 2c 0d |y (ahem)| event,.|
|00002a70| 09 74 68 69 73 20 69 73 | 20 63 61 6c 6c 65 64 20 |.this is| called |
|00002a80| 61 67 61 69 6e 20 62 65 | 66 6f 72 65 20 77 65 20 |again be|fore we |
|00002a90| 09 66 61 6c 6c 20 62 61 | 63 6b 20 69 6e 74 6f 20 |.fall ba|ck into |
|00002aa0| 57 4e 45 2e 20 2a 2f 0d | 0d 23 70 72 61 67 6d 61 |WNE. */.|.#pragma|
|00002ab0| 20 73 65 67 6d 65 6e 74 | 20 4d 61 69 6e 0d 76 6f | segment| Main.vo|
|00002ac0| 69 64 20 41 64 6a 75 73 | 74 43 75 72 73 6f 72 28 |id Adjus|tCursor(|
|00002ad0| 6d 6f 75 73 65 2c 72 65 | 67 69 6f 6e 29 0d 09 50 |mouse,re|gion)..P|
|00002ae0| 6f 69 6e 74 09 09 6d 6f | 75 73 65 3b 0d 09 52 67 |oint..mo|use;..Rg|
|00002af0| 6e 48 61 6e 64 6c 65 09 | 72 65 67 69 6f 6e 3b 0d |nHandle.|region;.|
|00002b00| 7b 0d 09 57 69 6e 64 6f | 77 50 74 72 09 77 69 6e |{..Windo|wPtr.win|
|00002b10| 64 6f 77 3b 0d 09 52 67 | 6e 48 61 6e 64 6c 65 09 |dow;..Rg|nHandle.|
|00002b20| 61 72 72 6f 77 52 67 6e | 3b 0d 09 52 67 6e 48 61 |arrowRgn|;..RgnHa|
|00002b30| 6e 64 6c 65 09 70 6c 75 | 73 52 67 6e 3b 0d 09 52 |ndle.plu|sRgn;..R|
|00002b40| 65 63 74 09 09 67 6c 6f | 62 61 6c 50 6f 72 74 52 |ect..glo|balPortR|
|00002b50| 65 63 74 3b 0d 0d 09 77 | 69 6e 64 6f 77 20 3d 20 |ect;...w|indow = |
|00002b60| 46 72 6f 6e 74 57 69 6e | 64 6f 77 28 29 3b 09 2f |FrontWin|dow();./|
|00002b70| 2a 20 77 65 20 6f 6e 6c | 79 20 61 64 6a 75 73 74 |* we onl|y adjust|
|00002b80| 20 74 68 65 20 63 75 72 | 73 6f 72 20 77 68 65 6e | the cur|sor when|
|00002b90| 20 77 65 20 61 72 65 20 | 69 6e 20 66 72 6f 6e 74 | we are |in front|
|00002ba0| 20 2a 2f 0d 09 69 66 20 | 28 20 28 21 20 67 49 6e | */..if |( (! gIn|
|00002bb0| 42 61 63 6b 67 72 6f 75 | 6e 64 29 20 26 26 20 28 |Backgrou|nd) && (|
|00002bc0| 21 20 49 73 44 41 57 69 | 6e 64 6f 77 28 77 69 6e |! IsDAWi|ndow(win|
|00002bd0| 64 6f 77 29 29 20 29 20 | 7b 0d 09 09 2f 2a 20 63 |dow)) ) |{.../* c|
|00002be0| 61 6c 63 75 6c 61 74 65 | 20 72 65 67 69 6f 6e 73 |alculate| regions|
|00002bf0| 20 66 6f 72 20 64 69 66 | 66 65 72 65 6e 74 20 63 | for dif|ferent c|
|00002c00| 75 72 73 6f 72 20 73 68 | 61 70 65 73 20 2a 2f 0d |ursor sh|apes */.|
|00002c10| 09 09 61 72 72 6f 77 52 | 67 6e 20 3d 20 4e 65 77 |..arrowR|gn = New|
|00002c20| 52 67 6e 28 29 3b 0d 09 | 09 70 6c 75 73 52 67 6e |Rgn();..|.plusRgn|
|00002c30| 20 3d 20 4e 65 77 52 67 | 6e 28 29 3b 0d 0d 09 09 | = NewRg|n();....|
|00002c40| 2f 2a 20 73 74 61 72 74 | 20 77 69 74 68 20 61 20 |/* start| with a |
|00002c50| 62 69 67 2c 20 62 69 67 | 20 72 65 63 74 61 6e 67 |big, big| rectang|
|00002c60| 75 6c 61 72 20 72 65 67 | 69 6f 6e 20 2a 2f 0d 09 |ular reg|ion */..|
|00002c70| 09 53 65 74 52 65 63 74 | 52 67 6e 28 61 72 72 6f |.SetRect|Rgn(arro|
|00002c80| 77 52 67 6e 2c 20 6b 45 | 78 74 72 65 6d 65 4e 65 |wRgn, kE|xtremeNe|
|00002c90| 67 2c 20 6b 45 78 74 72 | 65 6d 65 4e 65 67 2c 20 |g, kExtr|emeNeg, |
|00002ca0| 6b 45 78 74 72 65 6d 65 | 50 6f 73 2c 20 6b 45 78 |kExtreme|Pos, kEx|
|00002cb0| 74 72 65 6d 65 50 6f 73 | 29 3b 0d 0d 09 09 2f 2a |tremePos|);..../*|
|00002cc0| 20 63 61 6c 63 75 6c 61 | 74 65 20 70 6c 75 73 52 | calcula|te plusR|
|00002cd0| 67 6e 20 2a 2f 0d 09 09 | 69 66 20 28 20 49 73 41 |gn */...|if ( IsA|
|00002ce0| 70 70 57 69 6e 64 6f 77 | 28 77 69 6e 64 6f 77 29 |ppWindow|(window)|
|00002cf0| 20 29 20 7b 0d 09 09 09 | 53 65 74 50 6f 72 74 28 | ) {....|SetPort(|
|00002d00| 77 69 6e 64 6f 77 29 3b | 09 2f 2a 20 6d 61 6b 65 |window);|./* make|
|00002d10| 20 61 20 67 6c 6f 62 61 | 6c 20 76 65 72 73 69 6f | a globa|l versio|
|00002d20| 6e 20 6f 66 20 74 68 65 | 20 76 69 65 77 52 65 63 |n of the| viewRec|
|00002d30| 74 20 2a 2f 0d 09 09 09 | 53 65 74 4f 72 69 67 69 |t */....|SetOrigi|
|00002d40| 6e 28 2d 77 69 6e 64 6f | 77 2d 3e 70 6f 72 74 42 |n(-windo|w->portB|
|00002d50| 69 74 73 2e 62 6f 75 6e | 64 73 2e 6c 65 66 74 2c |its.boun|ds.left,|
|00002d60| 20 2d 77 69 6e 64 6f 77 | 2d 3e 70 6f 72 74 42 69 | -window|->portBi|
|00002d70| 74 73 2e 62 6f 75 6e 64 | 73 2e 74 6f 70 29 3b 0d |ts.bound|s.top);.|
|00002d80| 09 09 09 67 6c 6f 62 61 | 6c 50 6f 72 74 52 65 63 |...globa|lPortRec|
|00002d90| 74 20 3d 20 77 69 6e 64 | 6f 77 2d 3e 70 6f 72 74 |t = wind|ow->port|
|00002da0| 52 65 63 74 3b 0d 09 09 | 09 52 65 63 74 52 67 6e |Rect;...|.RectRgn|
|00002db0| 28 70 6c 75 73 52 67 6e | 2c 20 26 67 6c 6f 62 61 |(plusRgn|, &globa|
|00002dc0| 6c 50 6f 72 74 52 65 63 | 74 29 3b 0d 09 09 09 53 |lPortRec|t);....S|
|00002dd0| 65 63 74 52 67 6e 28 70 | 6c 75 73 52 67 6e 2c 20 |ectRgn(p|lusRgn, |
|00002de0| 77 69 6e 64 6f 77 2d 3e | 76 69 73 52 67 6e 2c 20 |window->|visRgn, |
|00002df0| 70 6c 75 73 52 67 6e 29 | 3b 0d 09 09 09 53 65 74 |plusRgn)|;....Set|
|00002e00| 4f 72 69 67 69 6e 28 30 | 2c 20 30 29 3b 0d 09 09 |Origin(0|, 0);...|
|00002e10| 7d 0d 0d 09 09 2f 2a 20 | 73 75 62 74 72 61 63 74 |}..../* |subtract|
|00002e20| 20 6f 74 68 65 72 20 72 | 65 67 69 6f 6e 73 20 66 | other r|egions f|
|00002e30| 72 6f 6d 20 61 72 72 6f | 77 52 67 6e 20 2a 2f 0d |rom arro|wRgn */.|
|00002e40| 09 09 44 69 66 66 52 67 | 6e 28 61 72 72 6f 77 52 |..DiffRg|n(arrowR|
|00002e50| 67 6e 2c 20 70 6c 75 73 | 52 67 6e 2c 20 61 72 72 |gn, plus|Rgn, arr|
|00002e60| 6f 77 52 67 6e 29 3b 0d | 0d 09 09 2f 2a 20 63 68 |owRgn);.|.../* ch|
|00002e70| 61 6e 67 65 20 74 68 65 | 20 63 75 72 73 6f 72 20 |ange the| cursor |
|00002e80| 61 6e 64 20 74 68 65 20 | 72 65 67 69 6f 6e 20 70 |and the |region p|
|00002e90| 61 72 61 6d 65 74 65 72 | 20 2a 2f 0d 09 09 69 66 |arameter| */...if|
|00002ea0| 20 28 20 50 74 49 6e 52 | 67 6e 28 6d 6f 75 73 65 | ( PtInR|gn(mouse|
|00002eb0| 2c 20 70 6c 75 73 52 67 | 6e 29 20 29 20 7b 0d 09 |, plusRg|n) ) {..|
|00002ec0| 09 09 53 65 74 43 75 72 | 73 6f 72 28 2a 47 65 74 |..SetCur|sor(*Get|
|00002ed0| 43 75 72 73 6f 72 28 70 | 6c 75 73 43 75 72 73 6f |Cursor(p|lusCurso|
|00002ee0| 72 29 29 3b 0d 09 09 09 | 43 6f 70 79 52 67 6e 28 |r));....|CopyRgn(|
|00002ef0| 70 6c 75 73 52 67 6e 2c | 20 72 65 67 69 6f 6e 29 |plusRgn,| region)|
|00002f00| 3b 0d 09 09 7d 20 65 6c | 73 65 20 7b 0d 09 09 09 |;...} el|se {....|
|00002f10| 53 65 74 43 75 72 73 6f | 72 28 26 71 64 2e 61 72 |SetCurso|r(&qd.ar|
|00002f20| 72 6f 77 29 3b 0d 09 09 | 09 43 6f 70 79 52 67 6e |row);...|.CopyRgn|
|00002f30| 28 61 72 72 6f 77 52 67 | 6e 2c 20 72 65 67 69 6f |(arrowRg|n, regio|
|00002f40| 6e 29 3b 0d 09 09 7d 0d | 0d 09 09 2f 2a 20 67 65 |n);...}.|.../* ge|
|00002f50| 74 20 72 69 64 20 6f 66 | 20 6f 75 72 20 6c 6f 63 |t rid of| our loc|
|00002f60| 61 6c 20 72 65 67 69 6f | 6e 73 20 2a 2f 0d 09 09 |al regio|ns */...|
|00002f70| 44 69 73 70 6f 73 65 52 | 67 6e 28 61 72 72 6f 77 |DisposeR|gn(arrow|
|00002f80| 52 67 6e 29 3b 0d 09 09 | 44 69 73 70 6f 73 65 52 |Rgn);...|DisposeR|
|00002f90| 67 6e 28 70 6c 75 73 52 | 67 6e 29 3b 0d 09 7d 0d |gn(plusR|gn);..}.|
|00002fa0| 7d 20 2f 2a 41 64 6a 75 | 73 74 43 75 72 73 6f 72 |} /*Adju|stCursor|
|00002fb0| 2a 2f 0d 0d 0d 2f 2a 09 | 47 65 74 20 74 68 65 20 |*/.../*.|Get the |
|00002fc0| 67 6c 6f 62 61 6c 20 63 | 6f 6f 72 64 69 6e 61 74 |global c|oordinat|
|00002fd0| 65 73 20 6f 66 20 74 68 | 65 20 6d 6f 75 73 65 2e |es of th|e mouse.|
|00002fe0| 20 57 68 65 6e 20 79 6f | 75 20 63 61 6c 6c 20 4f | When yo|u call O|
|00002ff0| 53 45 76 65 6e 74 41 76 | 61 69 6c 0d 09 69 74 20 |SEventAv|ail..it |
|00003000| 77 69 6c 6c 20 72 65 74 | 75 72 6e 20 65 69 74 68 |will ret|urn eith|
|00003010| 65 72 20 61 20 70 65 6e | 64 69 6e 67 20 65 76 65 |er a pen|ding eve|
|00003020| 6e 74 20 6f 72 20 61 20 | 6e 75 6c 6c 20 65 76 65 |nt or a |null eve|
|00003030| 6e 74 2e 20 49 6e 20 65 | 69 74 68 65 72 20 63 61 |nt. In e|ither ca|
|00003040| 73 65 2c 0d 09 74 68 65 | 20 77 68 65 72 65 20 66 |se,..the| where f|
|00003050| 69 65 6c 64 20 6f 66 20 | 74 68 65 20 65 76 65 6e |ield of |the even|
|00003060| 74 20 72 65 63 6f 72 64 | 20 77 69 6c 6c 20 63 6f |t record| will co|
|00003070| 6e 74 61 69 6e 20 74 68 | 65 20 63 75 72 72 65 6e |ntain th|e curren|
|00003080| 74 20 70 6f 73 69 74 69 | 6f 6e 0d 09 6f 66 20 74 |t positi|on..of t|
|00003090| 68 65 20 6d 6f 75 73 65 | 20 69 6e 20 67 6c 6f 62 |he mouse| in glob|
|000030a0| 61 6c 20 63 6f 6f 72 64 | 69 6e 61 74 65 73 20 61 |al coord|inates a|
|000030b0| 6e 64 20 74 68 65 20 6d | 6f 64 69 66 69 65 72 73 |nd the m|odifiers|
|000030c0| 20 66 69 65 6c 64 20 77 | 69 6c 6c 20 72 65 66 6c | field w|ill refl|
|000030d0| 65 63 74 0d 09 74 68 65 | 20 63 75 72 72 65 6e 74 |ect..the| current|
|000030e0| 20 73 74 61 74 65 20 6f | 66 20 74 68 65 20 6d 6f | state o|f the mo|
|000030f0| 64 69 66 69 65 72 73 2e | 20 41 6e 6f 74 68 65 72 |difiers.| Another|
|00003100| 20 77 61 79 20 74 6f 20 | 67 65 74 20 74 68 65 20 | way to |get the |
|00003110| 67 6c 6f 62 61 6c 0d 09 | 63 6f 6f 72 64 69 6e 61 |global..|coordina|
|00003120| 74 65 73 20 69 73 20 74 | 6f 20 63 61 6c 6c 20 47 |tes is t|o call G|
|00003130| 65 74 4d 6f 75 73 65 20 | 61 6e 64 20 4c 6f 63 61 |etMouse |and Loca|
|00003140| 6c 54 6f 47 6c 6f 62 61 | 6c 2c 20 62 75 74 20 74 |lToGloba|l, but t|
|00003150| 68 61 74 20 72 65 71 75 | 69 72 65 73 0d 09 62 65 |hat requ|ires..be|
|00003160| 69 6e 67 20 73 75 72 65 | 20 74 68 61 74 20 74 68 |ing sure| that th|
|00003170| 65 50 6f 72 74 20 69 73 | 20 73 65 74 20 74 6f 20 |ePort is| set to |
|00003180| 61 20 76 61 6c 69 64 20 | 70 6f 72 74 2e 20 2a 2f |a valid |port. */|
|00003190| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|000031a0| 74 20 4d 61 69 6e 0d 76 | 6f 69 64 20 47 65 74 47 |t Main.v|oid GetG|
|000031b0| 6c 6f 62 61 6c 4d 6f 75 | 73 65 28 6d 6f 75 73 65 |lobalMou|se(mouse|
|000031c0| 29 0d 09 50 6f 69 6e 74 | 09 2a 6d 6f 75 73 65 3b |)..Point|.*mouse;|
|000031d0| 0d 7b 0d 09 45 76 65 6e | 74 52 65 63 6f 72 64 09 |.{..Even|tRecord.|
|000031e0| 65 76 65 6e 74 3b 0d 09 | 0d 09 4f 53 45 76 65 6e |event;..|..OSEven|
|000031f0| 74 41 76 61 69 6c 28 6b | 4e 6f 45 76 65 6e 74 73 |tAvail(k|NoEvents|
|00003200| 2c 20 26 65 76 65 6e 74 | 29 3b 09 2f 2a 20 77 65 |, &event|);./* we|
|00003210| 20 61 72 65 6e 27 74 20 | 69 6e 74 65 72 65 73 74 | aren't |interest|
|00003220| 65 64 20 69 6e 20 61 6e | 79 20 65 76 65 6e 74 73 |ed in an|y events|
|00003230| 20 2a 2f 0d 09 2a 6d 6f | 75 73 65 20 3d 20 65 76 | */..*mo|use = ev|
|00003240| 65 6e 74 2e 77 68 65 72 | 65 3b 09 09 09 09 2f 2a |ent.wher|e;..../*|
|00003250| 20 6a 75 73 74 20 74 68 | 65 20 6d 6f 75 73 65 20 | just th|e mouse |
|00003260| 70 6f 73 69 74 69 6f 6e | 20 2a 2f 0d 7d 20 2f 2a |position| */.} /*|
|00003270| 47 65 74 47 6c 6f 62 61 | 6c 4d 6f 75 73 65 2a 2f |GetGloba|lMouse*/|
|00003280| 0d 0d 0d 2f 2a 09 54 68 | 69 73 20 69 73 20 63 61 |.../*.Th|is is ca|
|00003290| 6c 6c 65 64 20 77 68 65 | 6e 20 61 6e 20 75 70 64 |lled whe|n an upd|
|000032a0| 61 74 65 20 65 76 65 6e | 74 20 69 73 20 72 65 63 |ate even|t is rec|
|000032b0| 65 69 76 65 64 20 66 6f | 72 20 61 20 77 69 6e 64 |eived fo|r a wind|
|000032c0| 6f 77 2e 0d 09 49 74 20 | 63 61 6c 6c 73 20 44 72 |ow...It |calls Dr|
|000032d0| 61 77 57 69 6e 64 6f 77 | 20 74 6f 20 64 72 61 77 |awWindow| to draw|
|000032e0| 20 74 68 65 20 63 6f 6e | 74 65 6e 74 73 20 6f 66 | the con|tents of|
|000032f0| 20 61 6e 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 | an appl|ication |
|00003300| 77 69 6e 64 6f 77 2e 0d | 09 41 73 20 61 6e 20 65 |window..|.As an e|
|00003310| 66 66 65 63 69 65 6e 63 | 79 20 6d 65 61 73 75 72 |ffecienc|y measur|
|00003320| 65 20 74 68 61 74 20 64 | 6f 65 73 20 6e 6f 74 20 |e that d|oes not |
|00003330| 68 61 76 65 20 74 6f 20 | 62 65 20 66 6f 6c 6c 6f |have to |be follo|
|00003340| 77 65 64 2c 20 69 74 0d | 09 63 61 6c 6c 73 20 74 |wed, it.|.calls t|
|00003350| 68 65 20 64 72 61 77 69 | 6e 67 20 72 6f 75 74 69 |he drawi|ng routi|
|00003360| 6e 65 20 6f 6e 6c 79 20 | 69 66 20 74 68 65 20 76 |ne only |if the v|
|00003370| 69 73 52 67 6e 20 69 73 | 20 6e 6f 6e 2d 65 6d 70 |isRgn is| non-emp|
|00003380| 74 79 2e 20 54 68 69 73 | 0d 09 77 69 6c 6c 20 68 |ty. This|..will h|
|00003390| 61 6e 64 6c 65 20 73 69 | 74 75 61 74 69 6f 6e 73 |andle si|tuations|
|000033a0| 20 77 68 65 72 65 20 63 | 61 6c 63 75 6c 61 74 69 | where c|alculati|
|000033b0| 6f 6e 73 20 66 6f 72 20 | 64 72 61 77 69 6e 67 20 |ons for |drawing |
|000033c0| 6f 72 20 64 72 61 77 69 | 6e 67 0d 09 69 74 73 65 |or drawi|ng..itse|
|000033d0| 6c 66 20 69 73 20 76 65 | 72 79 20 74 69 6d 65 2d |lf is ve|ry time-|
|000033e0| 63 6f 6e 73 75 6d 69 6e | 67 2e 20 2a 2f 0d 0d 23 |consumin|g. */..#|
|000033f0| 70 72 61 67 6d 61 20 73 | 65 67 6d 65 6e 74 20 4d |pragma s|egment M|
|00003400| 61 69 6e 0d 76 6f 69 64 | 20 44 6f 55 70 64 61 74 |ain.void| DoUpdat|
|00003410| 65 28 77 69 6e 64 6f 77 | 29 0d 09 57 69 6e 64 6f |e(window|)..Windo|
|00003420| 77 50 74 72 09 77 69 6e | 64 6f 77 3b 0d 7b 0d 09 |wPtr.win|dow;.{..|
|00003430| 69 66 20 28 20 49 73 41 | 70 70 57 69 6e 64 6f 77 |if ( IsA|ppWindow|
|00003440| 28 77 69 6e 64 6f 77 29 | 20 29 20 7b 0d 09 09 42 |(window)| ) {...B|
|00003450| 65 67 69 6e 55 70 64 61 | 74 65 28 77 69 6e 64 6f |eginUpda|te(windo|
|00003460| 77 29 3b 09 09 09 09 2f | 2a 20 74 68 69 73 20 73 |w);..../|* this s|
|00003470| 65 74 73 20 75 70 20 74 | 68 65 20 76 69 73 52 67 |ets up t|he visRg|
|00003480| 6e 20 2a 2f 0d 09 09 69 | 66 20 28 20 21 20 45 6d |n */...i|f ( ! Em|
|00003490| 70 74 79 52 67 6e 28 77 | 69 6e 64 6f 77 2d 3e 76 |ptyRgn(w|indow->v|
|000034a0| 69 73 52 67 6e 29 20 29 | 09 2f 2a 20 64 72 61 77 |isRgn) )|./* draw|
|000034b0| 20 69 66 20 75 70 64 61 | 74 69 6e 67 20 6e 65 65 | if upda|ting nee|
|000034c0| 64 73 20 74 6f 20 62 65 | 20 64 6f 6e 65 20 2a 2f |ds to be| done */|
|000034d0| 0d 09 09 09 44 72 61 77 | 57 69 6e 64 6f 77 28 77 |....Draw|Window(w|
|000034e0| 69 6e 64 6f 77 29 3b 0d | 09 09 45 6e 64 55 70 64 |indow);.|..EndUpd|
|000034f0| 61 74 65 28 77 69 6e 64 | 6f 77 29 3b 0d 09 7d 0d |ate(wind|ow);..}.|
|00003500| 7d 20 2f 2a 44 6f 55 70 | 64 61 74 65 2a 2f 0d 0d |} /*DoUp|date*/..|
|00003510| 0d 2f 2a 09 54 68 69 73 | 20 69 73 20 63 61 6c 6c |./*.This| is call|
|00003520| 65 64 20 77 68 65 6e 20 | 61 20 77 69 6e 64 6f 77 |ed when |a window|
|00003530| 20 69 73 20 61 63 74 69 | 76 61 74 65 64 20 6f 72 | is acti|vated or|
|00003540| 20 64 65 61 63 74 69 76 | 61 74 65 64 2e 0d 09 49 | deactiv|ated...I|
|00003550| 6e 20 53 61 6d 70 6c 65 | 2c 20 74 68 65 20 57 69 |n Sample|, the Wi|
|00003560| 6e 64 6f 77 20 4d 61 6e | 61 67 65 72 27 73 20 68 |ndow Man|ager's h|
|00003570| 61 6e 64 6c 69 6e 67 20 | 6f 66 20 61 63 74 69 76 |andling |of activ|
|00003580| 61 74 65 20 61 6e 64 0d | 09 64 65 61 63 74 69 76 |ate and.|.deactiv|
|00003590| 61 74 65 20 65 76 65 6e | 74 73 20 69 73 20 73 75 |ate even|ts is su|
|000035a0| 66 66 69 63 69 65 6e 74 | 2e 20 4f 74 68 65 72 20 |fficient|. Other |
|000035b0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 73 20 6d 61 79 |applicat|ions may|
|000035c0| 20 68 61 76 65 0d 09 54 | 65 78 74 45 64 69 74 20 | have..T|extEdit |
|000035d0| 72 65 63 6f 72 64 73 2c | 20 63 6f 6e 74 72 6f 6c |records,| control|
|000035e0| 73 2c 20 6c 69 73 74 73 | 2c 20 65 74 63 2e 2c 20 |s, lists|, etc., |
|000035f0| 74 6f 20 61 63 74 69 76 | 61 74 65 2f 64 65 61 63 |to activ|ate/deac|
|00003600| 74 69 76 61 74 65 2e 20 | 2a 2f 0d 0d 23 70 72 61 |tivate. |*/..#pra|
|00003610| 67 6d 61 20 73 65 67 6d | 65 6e 74 20 4d 61 69 6e |gma segm|ent Main|
|00003620| 0d 76 6f 69 64 20 44 6f | 41 63 74 69 76 61 74 65 |.void Do|Activate|
|00003630| 28 77 69 6e 64 6f 77 2c | 20 62 65 63 6f 6d 69 6e |(window,| becomin|
|00003640| 67 41 63 74 69 76 65 29 | 0d 09 57 69 6e 64 6f 77 |gActive)|..Window|
|00003650| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 09 42 6f 6f |Ptr.wind|ow;..Boo|
|00003660| 6c 65 61 6e 09 09 62 65 | 63 6f 6d 69 6e 67 41 63 |lean..be|comingAc|
|00003670| 74 69 76 65 3b 0d 7b 0d | 09 69 66 20 28 20 49 73 |tive;.{.|.if ( Is|
|00003680| 41 70 70 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |AppWindo|w(window|
|00003690| 29 20 29 20 7b 0d 09 09 | 69 66 20 28 20 62 65 63 |) ) {...|if ( bec|
|000036a0| 6f 6d 69 6e 67 41 63 74 | 69 76 65 20 29 0d 09 09 |omingAct|ive )...|
|000036b0| 09 2f 2a 20 64 6f 20 77 | 68 61 74 65 76 65 72 20 |./* do w|hatever |
|000036c0| 79 6f 75 20 6e 65 65 64 | 20 74 6f 20 61 74 20 61 |you need| to at a|
|000036d0| 63 74 69 76 61 74 69 6f | 6e 20 2a 2f 20 3b 0d 09 |ctivatio|n */ ;..|
|000036e0| 09 65 6c 73 65 0d 09 09 | 09 2f 2a 20 64 6f 20 77 |.else...|./* do w|
|000036f0| 68 61 74 65 76 65 72 20 | 79 6f 75 20 6e 65 65 64 |hatever |you need|
|00003700| 20 74 6f 20 61 74 20 64 | 65 61 63 74 69 76 61 74 | to at d|eactivat|
|00003710| 69 6f 6e 20 2a 2f 20 3b | 0d 09 7d 0d 7d 20 2f 2a |ion */ ;|..}.} /*|
|00003720| 44 6f 41 63 74 69 76 61 | 74 65 2a 2f 0d 0d 0d 2f |DoActiva|te*/.../|
|00003730| 2a 09 54 68 69 73 20 69 | 73 20 63 61 6c 6c 65 64 |*.This i|s called|
|00003740| 20 77 68 65 6e 20 61 20 | 6d 6f 75 73 65 2d 64 6f | when a |mouse-do|
|00003750| 77 6e 20 65 76 65 6e 74 | 20 6f 63 63 75 72 73 20 |wn event| occurs |
|00003760| 69 6e 20 74 68 65 20 63 | 6f 6e 74 65 6e 74 20 6f |in the c|ontent o|
|00003770| 66 20 61 20 77 69 6e 64 | 6f 77 2e 0d 09 4f 74 68 |f a wind|ow...Oth|
|00003780| 65 72 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 73 20 |er appli|cations |
|00003790| 6d 69 67 68 74 20 77 61 | 6e 74 20 74 6f 20 63 61 |might wa|nt to ca|
|000037a0| 6c 6c 20 46 69 6e 64 43 | 6f 6e 74 72 6f 6c 2c 20 |ll FindC|ontrol, |
|000037b0| 54 45 43 6c 69 63 6b 2c | 20 65 74 63 2e 2c 20 74 |TEClick,| etc., t|
|000037c0| 6f 0d 09 66 75 72 74 68 | 65 72 20 70 72 6f 63 65 |o..furth|er proce|
|000037d0| 73 73 20 74 68 65 20 63 | 6c 69 63 6b 2e 20 2a 2f |ss the c|lick. */|
|000037e0| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|000037f0| 74 20 4d 61 69 6e 0d 76 | 6f 69 64 20 44 6f 43 6f |t Main.v|oid DoCo|
|00003800| 6e 74 65 6e 74 43 6c 69 | 63 6b 28 77 69 6e 64 6f |ntentCli|ck(windo|
|00003810| 77 29 0d 09 57 69 6e 64 | 6f 77 50 74 72 09 77 69 |w)..Wind|owPtr.wi|
|00003820| 6e 64 6f 77 3b 0d 7b 0d | 09 53 65 74 4c 69 67 68 |ndow;.{.|.SetLigh|
|00003830| 74 28 77 69 6e 64 6f 77 | 2c 20 21 20 67 53 74 6f |t(window|, ! gSto|
|00003840| 70 70 65 64 29 3b 0d 7d | 20 2f 2a 44 6f 43 6f 6e |pped);.}| /*DoCon|
|00003850| 74 65 6e 74 43 6c 69 63 | 6b 2a 2f 0d 0d 0d 2f 2a |tentClic|k*/.../*|
|00003860| 20 44 72 61 77 20 74 68 | 65 20 63 6f 6e 74 65 6e | Draw th|e conten|
|00003870| 74 73 20 6f 66 20 74 68 | 65 20 61 70 70 6c 69 63 |ts of th|e applic|
|00003880| 61 74 69 6f 6e 20 77 69 | 6e 64 6f 77 2e 20 57 65 |ation wi|ndow. We|
|00003890| 20 64 6f 20 73 6f 6d 65 | 20 64 72 61 77 69 6e 67 | do some| drawing|
|000038a0| 20 69 6e 20 63 6f 6c 6f | 72 2c 20 75 73 69 6e 67 | in colo|r, using|
|000038b0| 0d 20 20 20 43 6c 61 73 | 73 69 63 20 51 75 69 63 |. Clas|sic Quic|
|000038c0| 6b 44 72 61 77 27 73 20 | 63 6f 6c 6f 72 20 63 61 |kDraw's |color ca|
|000038d0| 70 61 62 69 6c 69 74 69 | 65 73 2e 20 54 68 69 73 |pabiliti|es. This|
|000038e0| 20 77 69 6c 6c 20 62 65 | 20 62 6c 61 63 6b 20 61 | will be| black a|
|000038f0| 6e 64 20 77 68 69 74 65 | 20 6f 6e 20 6f 6c 64 0d |nd white| on old.|
|00003900| 20 20 20 6d 61 63 68 69 | 6e 65 73 2c 20 62 75 74 | machi|nes, but|
|00003910| 20 63 6f 6c 6f 72 20 6f | 6e 20 63 6f 6c 6f 72 20 | color o|n color |
|00003920| 6d 61 63 68 69 6e 65 73 | 2e 20 41 74 20 74 68 69 |machines|. At thi|
|00003930| 73 20 70 6f 69 6e 74 2c | 20 74 68 65 20 77 69 6e |s point,| the win|
|00003940| 64 6f 77 d5 73 20 76 69 | 73 52 67 6e 0d 20 20 20 |dow.s vi|sRgn. |
|00003950| 69 73 20 73 65 74 20 74 | 6f 20 61 6c 6c 6f 77 20 |is set t|o allow |
|00003960| 64 72 61 77 69 6e 67 20 | 6f 6e 6c 79 20 77 68 65 |drawing |only whe|
|00003970| 72 65 20 69 74 20 6e 65 | 65 64 73 20 74 6f 20 62 |re it ne|eds to b|
|00003980| 65 20 64 6f 6e 65 2e 20 | 2a 2f 0d 0d 23 70 72 61 |e done. |*/..#pra|
|00003990| 67 6d 61 20 73 65 67 6d | 65 6e 74 20 4d 61 69 6e |gma segm|ent Main|
|000039a0| 0d 76 6f 69 64 20 44 72 | 61 77 57 69 6e 64 6f 77 |.void Dr|awWindow|
|000039b0| 28 77 69 6e 64 6f 77 29 | 0d 09 57 69 6e 64 6f 77 |(window)|..Window|
|000039c0| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 7b 0d 09 53 |Ptr.wind|ow;.{..S|
|000039d0| 65 74 50 6f 72 74 28 77 | 69 6e 64 6f 77 29 3b 0d |etPort(w|indow);.|
|000039e0| 0d 09 45 72 61 73 65 52 | 65 63 74 28 26 77 69 6e |..EraseR|ect(&win|
|000039f0| 64 6f 77 2d 3e 70 6f 72 | 74 52 65 63 74 29 3b 09 |dow->por|tRect);.|
|00003a00| 2f 2a 20 63 6c 65 61 72 | 20 6f 75 74 20 61 6e 79 |/* clear| out any|
|00003a10| 20 67 61 72 62 61 67 65 | 20 74 68 61 74 20 6d 61 | garbage| that ma|
|00003a20| 79 20 6c 69 6e 67 65 72 | 20 2a 2f 0d 09 69 66 20 |y linger| */..if |
|00003a30| 28 20 67 53 74 6f 70 70 | 65 64 20 29 09 09 09 09 |( gStopp|ed )....|
|00003a40| 09 2f 2a 20 64 72 61 77 | 20 61 20 72 65 64 20 28 |./* draw| a red (|
|00003a50| 6f 72 20 77 68 69 74 65 | 29 20 73 74 6f 70 20 6c |or white|) stop l|
|00003a60| 69 67 68 74 20 2a 2f 0d | 09 09 46 6f 72 65 43 6f |ight */.|..ForeCo|
|00003a70| 6c 6f 72 28 72 65 64 43 | 6f 6c 6f 72 29 3b 0d 09 |lor(redC|olor);..|
|00003a80| 65 6c 73 65 0d 09 09 46 | 6f 72 65 43 6f 6c 6f 72 |else...F|oreColor|
|00003a90| 28 77 68 69 74 65 43 6f | 6c 6f 72 29 3b 0d 09 50 |(whiteCo|lor);..P|
|00003aa0| 61 69 6e 74 4f 76 61 6c | 28 26 67 53 74 6f 70 52 |aintOval|(&gStopR|
|00003ab0| 65 63 74 29 3b 0d 09 46 | 6f 72 65 43 6f 6c 6f 72 |ect);..F|oreColor|
|00003ac0| 28 62 6c 61 63 6b 43 6f | 6c 6f 72 29 3b 0d 09 46 |(blackCo|lor);..F|
|00003ad0| 72 61 6d 65 4f 76 61 6c | 28 26 67 53 74 6f 70 52 |rameOval|(&gStopR|
|00003ae0| 65 63 74 29 3b 0d 09 69 | 66 20 28 20 21 20 67 53 |ect);..i|f ( ! gS|
|00003af0| 74 6f 70 70 65 64 20 29 | 09 09 09 09 2f 2a 20 64 |topped )|..../* d|
|00003b00| 72 61 77 20 61 20 67 72 | 65 65 6e 20 28 6f 72 20 |raw a gr|een (or |
|00003b10| 77 68 69 74 65 29 20 67 | 6f 20 6c 69 67 68 74 20 |white) g|o light |
|00003b20| 2a 2f 0d 09 09 46 6f 72 | 65 43 6f 6c 6f 72 28 67 |*/...For|eColor(g|
|00003b30| 72 65 65 6e 43 6f 6c 6f | 72 29 3b 0d 09 65 6c 73 |reenColo|r);..els|
|00003b40| 65 0d 09 09 46 6f 72 65 | 43 6f 6c 6f 72 28 77 68 |e...Fore|Color(wh|
|00003b50| 69 74 65 43 6f 6c 6f 72 | 29 3b 0d 09 50 61 69 6e |iteColor|);..Pain|
|00003b60| 74 4f 76 61 6c 28 26 67 | 47 6f 52 65 63 74 29 3b |tOval(&g|GoRect);|
|00003b70| 0d 09 46 6f 72 65 43 6f | 6c 6f 72 28 62 6c 61 63 |..ForeCo|lor(blac|
|00003b80| 6b 43 6f 6c 6f 72 29 3b | 0d 09 46 72 61 6d 65 4f |kColor);|..FrameO|
|00003b90| 76 61 6c 28 26 67 47 6f | 52 65 63 74 29 3b 0d 7d |val(&gGo|Rect);.}|
|00003ba0| 20 2f 2a 44 72 61 77 57 | 69 6e 64 6f 77 2a 2f 0d | /*DrawW|indow*/.|
|00003bb0| 0d 0d 2f 2a 09 45 6e 61 | 62 6c 65 20 61 6e 64 20 |../*.Ena|ble and |
|00003bc0| 64 69 73 61 62 6c 65 20 | 6d 65 6e 75 73 20 62 61 |disable |menus ba|
|00003bd0| 73 65 64 20 6f 6e 20 74 | 68 65 20 63 75 72 72 65 |sed on t|he curre|
|00003be0| 6e 74 20 73 74 61 74 65 | 2e 0d 09 54 68 65 20 75 |nt state|...The u|
|00003bf0| 73 65 72 20 63 61 6e 20 | 6f 6e 6c 79 20 73 65 6c |ser can |only sel|
|00003c00| 65 63 74 20 65 6e 61 62 | 6c 65 64 20 6d 65 6e 75 |ect enab|led menu|
|00003c10| 20 69 74 65 6d 73 2e 20 | 57 65 20 73 65 74 20 75 | items. |We set u|
|00003c20| 70 20 61 6c 6c 20 74 68 | 65 20 6d 65 6e 75 20 69 |p all th|e menu i|
|00003c30| 74 65 6d 73 0d 09 62 65 | 66 6f 72 65 20 63 61 6c |tems..be|fore cal|
|00003c40| 6c 69 6e 67 20 4d 65 6e | 75 53 65 6c 65 63 74 20 |ling Men|uSelect |
|00003c50| 6f 72 20 4d 65 6e 75 4b | 65 79 2c 20 73 69 6e 63 |or MenuK|ey, sinc|
|00003c60| 65 20 74 68 65 73 65 20 | 61 72 65 20 74 68 65 20 |e these |are the |
|00003c70| 6f 6e 6c 79 20 74 69 6d | 65 73 20 74 68 61 74 0d |only tim|es that.|
|00003c80| 09 61 20 6d 65 6e 75 20 | 69 74 65 6d 20 63 61 6e |.a menu |item can|
|00003c90| 20 62 65 20 73 65 6c 65 | 63 74 65 64 2e 20 4e 6f | be sele|cted. No|
|00003ca0| 74 65 20 74 68 61 74 20 | 4d 65 6e 75 53 65 6c 65 |te that |MenuSele|
|00003cb0| 63 74 20 69 73 20 61 6c | 73 6f 20 74 68 65 20 6f |ct is al|so the o|
|00003cc0| 6e 6c 79 20 74 69 6d 65 | 0d 09 74 68 65 20 75 73 |nly time|..the us|
|00003cd0| 65 72 20 77 69 6c 6c 20 | 73 65 65 20 6d 65 6e 75 |er will |see menu|
|00003ce0| 20 69 74 65 6d 73 2e 20 | 54 68 69 73 20 61 70 70 | items. |This app|
|00003cf0| 72 6f 61 63 68 20 74 6f | 20 64 65 63 69 64 69 6e |roach to| decidin|
|00003d00| 67 20 77 68 61 74 20 65 | 6e 61 62 6c 65 2f 0d 09 |g what e|nable/..|
|00003d10| 64 69 73 61 62 6c 65 20 | 73 74 61 74 65 20 61 20 |disable |state a |
|00003d20| 6d 65 6e 75 20 69 74 65 | 6d 20 68 61 73 20 74 68 |menu ite|m has th|
|00003d30| 65 20 61 64 76 61 6e 74 | 61 67 65 20 6f 66 20 63 |e advant|age of c|
|00003d40| 6f 6e 63 65 6e 74 72 61 | 74 69 6e 67 20 61 6c 6c |oncentra|ting all|
|00003d50| 0d 09 74 68 65 20 64 65 | 63 69 73 69 6f 6e 2d 6d |..the de|cision-m|
|00003d60| 61 6b 69 6e 67 20 69 6e | 20 6f 6e 65 20 72 6f 75 |aking in| one rou|
|00003d70| 74 69 6e 65 2c 20 61 73 | 20 6f 70 70 6f 73 65 64 |tine, as| opposed|
|00003d80| 20 74 6f 20 62 65 69 6e | 67 20 73 70 72 65 61 64 | to bein|g spread|
|00003d90| 20 74 68 72 6f 75 67 68 | 6f 75 74 0d 09 74 68 65 | through|out..the|
|00003da0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 20 4f 74 | applica|tion. Ot|
|00003db0| 68 65 72 20 61 70 70 6c | 69 63 61 74 69 6f 6e 20 |her appl|ication |
|00003dc0| 64 65 73 69 67 6e 73 20 | 6d 61 79 20 74 61 6b 65 |designs |may take|
|00003dd0| 20 61 20 64 69 66 66 65 | 72 65 6e 74 20 61 70 70 | a diffe|rent app|
|00003de0| 72 6f 61 63 68 0d 09 74 | 68 61 74 20 69 73 20 6a |roach..t|hat is j|
|00003df0| 75 73 74 20 61 73 20 76 | 61 6c 69 64 2e 20 2a 2f |ust as v|alid. */|
|00003e00| 0d 0d 23 70 72 61 67 6d | 61 20 73 65 67 6d 65 6e |..#pragm|a segmen|
|00003e10| 74 20 4d 61 69 6e 0d 76 | 6f 69 64 20 41 64 6a 75 |t Main.v|oid Adju|
|00003e20| 73 74 4d 65 6e 75 73 28 | 29 0d 7b 0d 09 57 69 6e |stMenus(|).{..Win|
|00003e30| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 09 |dowPtr.w|indow;..|
|00003e40| 4d 65 6e 75 48 61 6e 64 | 6c 65 09 6d 65 6e 75 3b |MenuHand|le.menu;|
|00003e50| 0d 0d 09 77 69 6e 64 6f | 77 20 3d 20 46 72 6f 6e |...windo|w = Fron|
|00003e60| 74 57 69 6e 64 6f 77 28 | 29 3b 0d 0d 09 6d 65 6e |tWindow(|);...men|
|00003e70| 75 20 3d 20 47 65 74 4d | 48 61 6e 64 6c 65 28 6d |u = GetM|Handle(m|
|00003e80| 46 69 6c 65 29 3b 0d 09 | 69 66 20 28 20 49 73 44 |File);..|if ( IsD|
|00003e90| 41 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 29 20 |AWindow(|window) |
|00003ea0| 29 09 09 2f 2a 20 77 65 | 20 63 61 6e 20 61 6c 6c |)../* we| can all|
|00003eb0| 6f 77 20 64 65 73 6b 20 | 61 63 63 65 73 73 6f 72 |ow desk |accessor|
|00003ec0| 69 65 73 20 74 6f 20 62 | 65 20 63 6c 6f 73 65 64 |ies to b|e closed|
|00003ed0| 20 66 72 6f 6d 20 74 68 | 65 20 6d 65 6e 75 20 2a | from th|e menu *|
|00003ee0| 2f 0d 09 09 45 6e 61 62 | 6c 65 49 74 65 6d 28 6d |/...Enab|leItem(m|
|00003ef0| 65 6e 75 2c 20 69 43 6c | 6f 73 65 29 3b 0d 09 65 |enu, iCl|ose);..e|
|00003f00| 6c 73 65 0d 09 09 44 69 | 73 61 62 6c 65 49 74 65 |lse...Di|sableIte|
|00003f10| 6d 28 6d 65 6e 75 2c 20 | 69 43 6c 6f 73 65 29 3b |m(menu, |iClose);|
|00003f20| 09 2f 2a 20 62 75 74 20 | 6e 6f 74 20 6f 75 72 20 |./* but |not our |
|00003f30| 74 72 61 66 66 69 63 20 | 6c 69 67 68 74 20 77 69 |traffic |light wi|
|00003f40| 6e 64 6f 77 20 2a 2f 0d | 0d 09 6d 65 6e 75 20 3d |ndow */.|..menu =|
|00003f50| 20 47 65 74 4d 48 61 6e | 64 6c 65 28 6d 45 64 69 | GetMHan|dle(mEdi|
|00003f60| 74 29 3b 0d 09 69 66 20 | 28 20 49 73 44 41 57 69 |t);..if |( IsDAWi|
|00003f70| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 20 29 20 7b |ndow(win|dow) ) {|
|00003f80| 09 09 2f 2a 20 61 20 64 | 65 73 6b 20 61 63 63 65 |../* a d|esk acce|
|00003f90| 73 73 6f 72 79 20 6d 69 | 67 68 74 20 6e 65 65 64 |ssory mi|ght need|
|00003fa0| 20 74 68 65 20 65 64 69 | 74 20 6d 65 6e 75 c9 20 | the edi|t menu. |
|00003fb0| 2a 2f 0d 09 09 45 6e 61 | 62 6c 65 49 74 65 6d 28 |*/...Ena|bleItem(|
|00003fc0| 6d 65 6e 75 2c 20 69 55 | 6e 64 6f 29 3b 0d 09 09 |menu, iU|ndo);...|
|00003fd0| 45 6e 61 62 6c 65 49 74 | 65 6d 28 6d 65 6e 75 2c |EnableIt|em(menu,|
|00003fe0| 20 69 43 75 74 29 3b 0d | 09 09 45 6e 61 62 6c 65 | iCut);.|..Enable|
|00003ff0| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 6f 70 79 |Item(men|u, iCopy|
|00004000| 29 3b 0d 09 09 45 6e 61 | 62 6c 65 49 74 65 6d 28 |);...Ena|bleItem(|
|00004010| 6d 65 6e 75 2c 20 69 43 | 6c 65 61 72 29 3b 0d 09 |menu, iC|lear);..|
|00004020| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |.EnableI|tem(menu|
|00004030| 2c 20 69 50 61 73 74 65 | 29 3b 0d 09 7d 20 65 6c |, iPaste|);..} el|
|00004040| 73 65 20 7b 09 09 09 09 | 09 09 2f 2a 20 c9 62 75 |se {....|../* .bu|
|00004050| 74 20 77 65 20 64 6f 6e | d5 74 20 75 73 65 20 69 |t we don|.t use i|
|00004060| 74 20 2a 2f 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |t */...D|isableIt|
|00004070| 65 6d 28 6d 65 6e 75 2c | 20 69 55 6e 64 6f 29 3b |em(menu,| iUndo);|
|00004080| 0d 09 09 44 69 73 61 62 | 6c 65 49 74 65 6d 28 6d |...Disab|leItem(m|
|00004090| 65 6e 75 2c 20 69 43 75 | 74 29 3b 0d 09 09 44 69 |enu, iCu|t);...Di|
|000040a0| 73 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |sableIte|m(menu, |
|000040b0| 69 43 6f 70 79 29 3b 0d | 09 09 44 69 73 61 62 6c |iCopy);.|..Disabl|
|000040c0| 65 49 74 65 6d 28 6d 65 | 6e 75 2c 20 69 43 6c 65 |eItem(me|nu, iCle|
|000040d0| 61 72 29 3b 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |ar);...D|isableIt|
|000040e0| 65 6d 28 6d 65 6e 75 2c | 20 69 50 61 73 74 65 29 |em(menu,| iPaste)|
|000040f0| 3b 0d 09 7d 0d 0d 09 6d | 65 6e 75 20 3d 20 47 65 |;..}...m|enu = Ge|
|00004100| 74 4d 48 61 6e 64 6c 65 | 28 6d 4c 69 67 68 74 29 |tMHandle|(mLight)|
|00004110| 3b 0d 09 69 66 20 28 20 | 49 73 41 70 70 57 69 6e |;..if ( |IsAppWin|
|00004120| 64 6f 77 28 77 69 6e 64 | 6f 77 29 20 29 20 7b 09 |dow(wind|ow) ) {.|
|00004130| 2f 2a 20 77 65 20 6b 6e | 6f 77 20 74 68 61 74 20 |/* we kn|ow that |
|00004140| 69 74 20 6d 75 73 74 20 | 62 65 20 74 68 65 20 74 |it must |be the t|
|00004150| 72 61 66 66 69 63 20 6c | 69 67 68 74 20 2a 2f 0d |raffic l|ight */.|
|00004160| 09 09 45 6e 61 62 6c 65 | 49 74 65 6d 28 6d 65 6e |..Enable|Item(men|
|00004170| 75 2c 20 69 53 74 6f 70 | 29 3b 0d 09 09 45 6e 61 |u, iStop|);...Ena|
|00004180| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 47 |bleItem(|menu, iG|
|00004190| 6f 29 3b 0d 09 7d 20 65 | 6c 73 65 20 7b 0d 09 09 |o);..} e|lse {...|
|000041a0| 44 69 73 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |DisableI|tem(menu|
|000041b0| 2c 20 69 53 74 6f 70 29 | 3b 0d 09 09 44 69 73 61 |, iStop)|;...Disa|
|000041c0| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 47 |bleItem(|menu, iG|
|000041d0| 6f 29 3b 0d 09 7d 0d 09 | 43 68 65 63 6b 49 74 65 |o);..}..|CheckIte|
|000041e0| 6d 28 6d 65 6e 75 2c 20 | 69 53 74 6f 70 2c 20 67 |m(menu, |iStop, g|
|000041f0| 53 74 6f 70 70 65 64 29 | 3b 20 2f 2a 20 77 65 20 |Stopped)|; /* we |
|00004200| 63 61 6e 20 61 6c 73 6f | 20 64 65 74 65 72 6d 69 |can also| determi|
|00004210| 6e 65 20 63 68 65 63 6b | 2f 75 6e 63 68 65 63 6b |ne check|/uncheck|
|00004220| 20 73 74 61 74 65 2c 20 | 74 6f 6f 20 2a 2f 0d 09 | state, |too */..|
|00004230| 43 68 65 63 6b 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |CheckIte|m(menu, |
|00004240| 69 47 6f 2c 20 21 20 67 | 53 74 6f 70 70 65 64 29 |iGo, ! g|Stopped)|
|00004250| 3b 0d 7d 20 2f 2a 41 64 | 6a 75 73 74 4d 65 6e 75 |;.} /*Ad|justMenu|
|00004260| 73 2a 2f 0d 0d 0d 2f 2a | 09 54 68 69 73 20 69 73 |s*/.../*|.This is|
|00004270| 20 63 61 6c 6c 65 64 20 | 77 68 65 6e 20 61 6e 20 | called |when an |
|00004280| 69 74 65 6d 20 69 73 20 | 63 68 6f 73 65 6e 20 66 |item is |chosen f|
|00004290| 72 6f 6d 20 74 68 65 20 | 6d 65 6e 75 20 62 61 72 |rom the |menu bar|
|000042a0| 20 28 61 66 74 65 72 20 | 63 61 6c 6c 69 6e 67 0d | (after |calling.|
|000042b0| 09 4d 65 6e 75 53 65 6c | 65 63 74 20 6f 72 20 4d |.MenuSel|ect or M|
|000042c0| 65 6e 75 4b 65 79 29 2e | 20 49 74 20 70 65 72 66 |enuKey).| It perf|
|000042d0| 6f 72 6d 73 20 74 68 65 | 20 72 69 67 68 74 20 6f |orms the| right o|
|000042e0| 70 65 72 61 74 69 6f 6e | 20 66 6f 72 20 65 61 63 |peration| for eac|
|000042f0| 68 20 63 6f 6d 6d 61 6e | 64 2e 0d 09 49 74 20 69 |h comman|d...It i|
|00004300| 73 20 67 6f 6f 64 20 74 | 6f 20 68 61 76 65 20 62 |s good t|o have b|
|00004310| 6f 74 68 20 74 68 65 20 | 72 65 73 75 6c 74 20 6f |oth the |result o|
|00004320| 66 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 61 6e 64 |f MenuSe|lect and|
|00004330| 20 4d 65 6e 75 4b 65 79 | 20 67 6f 20 74 6f 0d 09 | MenuKey| go to..|
|00004340| 6f 6e 65 20 72 6f 75 74 | 69 6e 65 20 6c 69 6b 65 |one rout|ine like|
|00004350| 20 74 68 69 73 20 74 6f | 20 6b 65 65 70 20 65 76 | this to| keep ev|
|00004360| 65 72 79 74 68 69 6e 67 | 20 6f 72 67 61 6e 69 7a |erything| organiz|
|00004370| 65 64 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |ed. */..|#pragma |
|00004380| 73 65 67 6d 65 6e 74 20 | 4d 61 69 6e 0d 76 6f 69 |segment |Main.voi|
|00004390| 64 20 44 6f 4d 65 6e 75 | 43 6f 6d 6d 61 6e 64 28 |d DoMenu|Command(|
|000043a0| 6d 65 6e 75 52 65 73 75 | 6c 74 29 0d 09 6c 6f 6e |menuResu|lt)..lon|
|000043b0| 67 09 09 6d 65 6e 75 52 | 65 73 75 6c 74 3b 0d 7b |g..menuR|esult;.{|
|000043c0| 0d 09 73 68 6f 72 74 09 | 09 6d 65 6e 75 49 44 3b |..short.|.menuID;|
|000043d0| 09 09 09 09 2f 2a 20 74 | 68 65 20 72 65 73 6f 75 |..../* t|he resou|
|000043e0| 72 63 65 20 49 44 20 6f | 66 20 74 68 65 20 73 65 |rce ID o|f the se|
|000043f0| 6c 65 63 74 65 64 20 6d | 65 6e 75 20 2a 2f 0d 09 |lected m|enu */..|
|00004400| 73 68 6f 72 74 09 09 6d | 65 6e 75 49 74 65 6d 3b |short..m|enuItem;|
|00004410| 09 09 09 2f 2a 20 74 68 | 65 20 69 74 65 6d 20 6e |.../* th|e item n|
|00004420| 75 6d 62 65 72 20 6f 66 | 20 74 68 65 20 73 65 6c |umber of| the sel|
|00004430| 65 63 74 65 64 20 6d 65 | 6e 75 20 2a 2f 0d 09 73 |ected me|nu */..s|
|00004440| 68 6f 72 74 09 09 69 74 | 65 6d 48 69 74 3b 0d 09 |hort..it|emHit;..|
|00004450| 53 74 72 32 35 35 09 09 | 64 61 4e 61 6d 65 3b 0d |Str255..|daName;.|
|00004460| 09 73 68 6f 72 74 09 09 | 64 61 52 65 66 4e 75 6d |.short..|daRefNum|
|00004470| 3b 0d 09 42 6f 6f 6c 65 | 61 6e 09 09 68 61 6e 64 |;..Boole|an..hand|
|00004480| 6c 65 64 42 79 44 41 3b | 0d 0d 09 6d 65 6e 75 49 |ledByDA;|...menuI|
|00004490| 44 20 3d 20 48 69 57 6f | 72 64 28 6d 65 6e 75 52 |D = HiWo|rd(menuR|
|000044a0| 65 73 75 6c 74 29 3b 09 | 2f 2a 20 75 73 65 20 6d |esult);.|/* use m|
|000044b0| 61 63 72 6f 73 20 66 6f | 72 20 65 66 66 69 63 69 |acros fo|r effici|
|000044c0| 65 6e 63 79 20 74 6f 2e | 2e 2e 20 2a 2f 0d 09 6d |ency to.|.. */..m|
|000044d0| 65 6e 75 49 74 65 6d 20 | 3d 20 4c 6f 57 6f 72 64 |enuItem |= LoWord|
|000044e0| 28 6d 65 6e 75 52 65 73 | 75 6c 74 29 3b 09 2f 2a |(menuRes|ult);./*|
|000044f0| 20 67 65 74 20 6d 65 6e | 75 20 69 74 65 6d 20 6e | get men|u item n|
|00004500| 75 6d 62 65 72 20 61 6e | 64 20 6d 65 6e 75 20 6e |umber an|d menu n|
|00004510| 75 6d 62 65 72 20 2a 2f | 0d 09 73 77 69 74 63 68 |umber */|..switch|
|00004520| 20 28 20 6d 65 6e 75 49 | 44 20 29 20 7b 0d 09 09 | ( menuI|D ) {...|
|00004530| 63 61 73 65 20 6d 41 70 | 70 6c 65 3a 0d 09 09 09 |case mAp|ple:....|
|00004540| 73 77 69 74 63 68 20 28 | 20 6d 65 6e 75 49 74 65 |switch (| menuIte|
|00004550| 6d 20 29 20 7b 0d 09 09 | 09 09 63 61 73 65 20 69 |m ) {...|..case i|
|00004560| 41 62 6f 75 74 3a 09 09 | 2f 2a 20 62 72 69 6e 67 |About:..|/* bring|
|00004570| 20 75 70 20 61 6c 65 72 | 74 20 66 6f 72 20 41 62 | up aler|t for Ab|
|00004580| 6f 75 74 20 2a 2f 0d 09 | 09 09 09 09 69 74 65 6d |out */..|....item|
|00004590| 48 69 74 20 3d 20 41 6c | 65 72 74 28 72 41 62 6f |Hit = Al|ert(rAbo|
|000045a0| 75 74 41 6c 65 72 74 2c | 20 6e 69 6c 29 3b 0d 09 |utAlert,| nil);..|
|000045b0| 09 09 09 09 62 72 65 61 | 6b 3b 0d 09 09 09 09 64 |....brea|k;.....d|
|000045c0| 65 66 61 75 6c 74 3a 09 | 09 09 2f 2a 20 61 6c 6c |efault:.|../* all|
|000045d0| 20 6e 6f 6e 2d 41 62 6f | 75 74 20 69 74 65 6d 73 | non-Abo|ut items|
|000045e0| 20 69 6e 20 74 68 69 73 | 20 6d 65 6e 75 20 61 72 | in this| menu ar|
|000045f0| 65 20 44 41 73 20 2a 2f | 0d 09 09 09 09 09 2f 2a |e DAs */|....../*|
|00004600| 20 74 79 70 65 20 53 74 | 72 32 35 35 20 69 73 20 | type St|r255 is |
|00004610| 61 6e 20 61 72 72 61 79 | 20 69 6e 20 4d 50 57 20 |an array| in MPW |
|00004620| 33 20 2a 2f 0d 09 09 09 | 09 09 47 65 74 49 74 65 |3 */....|..GetIte|
|00004630| 6d 28 47 65 74 4d 48 61 | 6e 64 6c 65 28 6d 41 70 |m(GetMHa|ndle(mAp|
|00004640| 70 6c 65 29 2c 20 6d 65 | 6e 75 49 74 65 6d 2c 20 |ple), me|nuItem, |
|00004650| 64 61 4e 61 6d 65 29 3b | 0d 09 09 09 09 09 64 61 |daName);|......da|
|00004660| 52 65 66 4e 75 6d 20 3d | 20 4f 70 65 6e 44 65 73 |RefNum =| OpenDes|
|00004670| 6b 41 63 63 28 64 61 4e | 61 6d 65 29 3b 0d 09 09 |kAcc(daN|ame);...|
|00004680| 09 09 09 62 72 65 61 6b | 3b 0d 09 09 09 7d 0d 09 |...break|;....}..|
|00004690| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|000046a0| 6d 46 69 6c 65 3a 0d 09 | 09 09 73 77 69 74 63 68 |mFile:..|..switch|
|000046b0| 20 28 20 6d 65 6e 75 49 | 74 65 6d 20 29 20 7b 0d | ( menuI|tem ) {.|
|000046c0| 09 09 09 09 63 61 73 65 | 20 69 43 6c 6f 73 65 3a |....case| iClose:|
|000046d0| 0d 09 09 09 09 09 44 6f | 43 6c 6f 73 65 57 69 6e |......Do|CloseWin|
|000046e0| 64 6f 77 28 46 72 6f 6e | 74 57 69 6e 64 6f 77 28 |dow(Fron|tWindow(|
|000046f0| 29 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |));.....|.break;.|
|00004700| 09 09 09 09 63 61 73 65 | 20 69 51 75 69 74 3a 0d |....case| iQuit:.|
|00004710| 09 09 09 09 09 54 65 72 | 6d 69 6e 61 74 65 28 29 |.....Ter|minate()|
|00004720| 3b 0d 09 09 09 09 09 62 | 72 65 61 6b 3b 0d 09 09 |;......b|reak;...|
|00004730| 09 7d 0d 09 09 09 62 72 | 65 61 6b 3b 0d 09 09 63 |.}....br|eak;...c|
|00004740| 61 73 65 20 6d 45 64 69 | 74 3a 09 09 09 09 09 2f |ase mEdi|t:...../|
|00004750| 2a 20 63 61 6c 6c 20 53 | 79 73 74 65 6d 45 64 69 |* call S|ystemEdi|
|00004760| 74 20 66 6f 72 20 44 41 | 20 65 64 69 74 69 6e 67 |t for DA| editing|
|00004770| 20 26 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 2a | & Multi|Finder *|
|00004780| 2f 0d 09 09 09 68 61 6e | 64 6c 65 64 42 79 44 41 |/....han|dledByDA|
|00004790| 20 3d 20 53 79 73 74 65 | 6d 45 64 69 74 28 6d 65 | = Syste|mEdit(me|
|000047a0| 6e 75 49 74 65 6d 2d 31 | 29 3b 09 2f 2a 20 73 69 |nuItem-1|);./* si|
|000047b0| 6e 63 65 20 77 65 20 64 | 6f 6e d5 74 20 64 6f 20 |nce we d|on.t do |
|000047c0| 61 6e 79 20 45 64 69 74 | 69 6e 67 20 2a 2f 0d 09 |any Edit|ing */..|
|000047d0| 09 09 62 72 65 61 6b 3b | 0d 09 09 63 61 73 65 20 |..break;|...case |
|000047e0| 6d 4c 69 67 68 74 3a 0d | 09 09 09 73 77 69 74 63 |mLight:.|...switc|
|000047f0| 68 20 28 20 6d 65 6e 75 | 49 74 65 6d 20 29 20 7b |h ( menu|Item ) {|
|00004800| 0d 09 09 09 09 63 61 73 | 65 20 69 53 74 6f 70 3a |.....cas|e iStop:|
|00004810| 0d 09 09 09 09 09 53 65 | 74 4c 69 67 68 74 28 46 |......Se|tLight(F|
|00004820| 72 6f 6e 74 57 69 6e 64 | 6f 77 28 29 2c 20 74 72 |rontWind|ow(), tr|
|00004830| 75 65 29 3b 0d 09 09 09 | 09 09 62 72 65 61 6b 3b |ue);....|..break;|
|00004840| 0d 09 09 09 09 63 61 73 | 65 20 69 47 6f 3a 0d 09 |.....cas|e iGo:..|
|00004850| 09 09 09 09 53 65 74 4c | 69 67 68 74 28 46 72 6f |....SetL|ight(Fro|
|00004860| 6e 74 57 69 6e 64 6f 77 | 28 29 2c 20 66 61 6c 73 |ntWindow|(), fals|
|00004870| 65 29 3b 0d 09 09 09 09 | 09 62 72 65 61 6b 3b 0d |e);.....|.break;.|
|00004880| 09 09 09 7d 0d 09 09 09 | 62 72 65 61 6b 3b 0d 09 |...}....|break;..|
|00004890| 7d 0d 09 48 69 6c 69 74 | 65 4d 65 6e 75 28 30 29 |}..Hilit|eMenu(0)|
|000048a0| 3b 09 09 09 09 09 2f 2a | 20 75 6e 68 69 67 68 6c |;...../*| unhighl|
|000048b0| 69 67 68 74 20 77 68 61 | 74 20 4d 65 6e 75 53 65 |ight wha|t MenuSe|
|000048c0| 6c 65 63 74 20 28 6f 72 | 20 4d 65 6e 75 4b 65 79 |lect (or| MenuKey|
|000048d0| 29 20 68 69 6c 69 74 65 | 64 20 2a 2f 0d 7d 20 2f |) hilite|d */.} /|
|000048e0| 2a 44 6f 4d 65 6e 75 43 | 6f 6d 6d 61 6e 64 2a 2f |*DoMenuC|ommand*/|
|000048f0| 0d 0d 0d 2f 2a 20 43 68 | 61 6e 67 65 20 74 68 65 |.../* Ch|ange the|
|00004900| 20 73 65 74 74 69 6e 67 | 20 6f 66 20 74 68 65 20 | setting| of the |
|00004910| 6c 69 67 68 74 2e 20 2a | 2f 0d 0d 23 70 72 61 67 |light. *|/..#prag|
|00004920| 6d 61 20 73 65 67 6d 65 | 6e 74 20 4d 61 69 6e 0d |ma segme|nt Main.|
|00004930| 76 6f 69 64 20 53 65 74 | 4c 69 67 68 74 28 20 77 |void Set|Light( w|
|00004940| 69 6e 64 6f 77 2c 20 6e | 65 77 53 74 6f 70 70 65 |indow, n|ewStoppe|
|00004950| 64 20 29 0d 09 57 69 6e | 64 6f 77 50 74 72 09 77 |d )..Win|dowPtr.w|
|00004960| 69 6e 64 6f 77 3b 0d 09 | 42 6f 6f 6c 65 61 6e 09 |indow;..|Boolean.|
|00004970| 09 6e 65 77 53 74 6f 70 | 70 65 64 3b 0d 7b 0d 09 |.newStop|ped;.{..|
|00004980| 69 66 20 28 20 6e 65 77 | 53 74 6f 70 70 65 64 20 |if ( new|Stopped |
|00004990| 21 3d 20 67 53 74 6f 70 | 70 65 64 20 29 20 7b 0d |!= gStop|ped ) {.|
|000049a0| 09 09 67 53 74 6f 70 70 | 65 64 20 3d 20 6e 65 77 |..gStopp|ed = new|
|000049b0| 53 74 6f 70 70 65 64 3b | 0d 09 09 53 65 74 50 6f |Stopped;|...SetPo|
|000049c0| 72 74 28 77 69 6e 64 6f | 77 29 3b 0d 09 09 49 6e |rt(windo|w);...In|
|000049d0| 76 61 6c 52 65 63 74 28 | 26 77 69 6e 64 6f 77 2d |valRect(|&window-|
|000049e0| 3e 70 6f 72 74 52 65 63 | 74 29 3b 0d 09 7d 0d 7d |>portRec|t);..}.}|
|000049f0| 20 2f 2a 53 65 74 4c 69 | 67 68 74 2a 2f 0d 0d 0d | /*SetLi|ght*/...|
|00004a00| 2f 2a 20 43 6c 6f 73 65 | 20 61 20 77 69 6e 64 6f |/* Close| a windo|
|00004a10| 77 2e 20 54 68 69 73 20 | 68 61 6e 64 6c 65 73 20 |w. This |handles |
|00004a20| 64 65 73 6b 20 61 63 63 | 65 73 73 6f 72 79 20 61 |desk acc|essory a|
|00004a30| 6e 64 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |nd appli|cation w|
|00004a40| 69 6e 64 6f 77 73 2e 20 | 2a 2f 0d 0d 2f 2a 09 31 |indows. |*/../*.1|
|00004a50| 2e 30 31 20 2d 20 41 74 | 20 74 68 69 73 20 70 6f |.01 - At| this po|
|00004a60| 69 6e 74 2c 20 69 66 20 | 74 68 65 72 65 20 77 61 |int, if |there wa|
|00004a70| 73 20 61 20 64 6f 63 75 | 6d 65 6e 74 20 61 73 73 |s a docu|ment ass|
|00004a80| 6f 63 69 61 74 65 64 20 | 77 69 74 68 20 61 0d 09 |ociated |with a..|
|00004a90| 77 69 6e 64 6f 77 2c 20 | 79 6f 75 20 63 6f 75 6c |window, |you coul|
|00004aa0| 64 20 64 6f 20 61 6e 79 | 20 64 6f 63 75 6d 65 6e |d do any| documen|
|00004ab0| 74 20 73 61 76 69 6e 67 | 20 70 72 6f 63 65 73 73 |t saving| process|
|00004ac0| 69 6e 67 20 69 66 20 69 | 74 20 69 73 20 27 64 69 |ing if i|t is 'di|
|00004ad0| 72 74 79 27 2e 0d 09 44 | 6f 43 6c 6f 73 65 57 69 |rty'...D|oCloseWi|
|00004ae0| 6e 64 6f 77 20 77 6f 75 | 6c 64 20 72 65 74 75 72 |ndow wou|ld retur|
|00004af0| 6e 20 74 72 75 65 20 69 | 66 20 74 68 65 20 77 69 |n true i|f the wi|
|00004b00| 6e 64 6f 77 20 61 63 74 | 75 61 6c 6c 79 20 63 6c |ndow act|ually cl|
|00004b10| 6f 73 65 64 2c 20 69 2e | 65 2e 2c 0d 09 74 68 65 |osed, i.|e.,..the|
|00004b20| 20 75 73 65 72 20 64 69 | 64 6e d5 74 20 63 61 6e | user di|dn.t can|
|00004b30| 63 65 6c 20 66 72 6f 6d | 20 61 20 73 61 76 65 20 |cel from| a save |
|00004b40| 64 69 61 6c 6f 67 2e 20 | 54 68 69 73 20 72 65 73 |dialog. |This res|
|00004b50| 75 6c 74 20 69 73 20 68 | 61 6e 64 79 20 77 68 65 |ult is h|andy whe|
|00004b60| 6e 0d 09 74 68 65 20 75 | 73 65 72 20 71 75 69 74 |n..the u|ser quit|
|00004b70| 73 20 61 6e 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |s an app|lication|
|00004b80| 2c 20 62 75 74 20 74 68 | 65 6e 20 63 61 6e 63 65 |, but th|en cance|
|00004b90| 6c 73 20 74 68 65 20 73 | 61 76 65 20 6f 66 20 61 |ls the s|ave of a|
|00004ba0| 20 64 6f 63 75 6d 65 6e | 74 0d 09 61 73 73 6f 63 | documen|t..assoc|
|00004bb0| 69 61 74 65 64 20 77 69 | 74 68 20 61 20 77 69 6e |iated wi|th a win|
|00004bc0| 64 6f 77 2e 20 2a 2f 0d | 0d 23 70 72 61 67 6d 61 |dow. */.|.#pragma|
|00004bd0| 20 73 65 67 6d 65 6e 74 | 20 4d 61 69 6e 0d 42 6f | segment| Main.Bo|
|00004be0| 6f 6c 65 61 6e 20 44 6f | 43 6c 6f 73 65 57 69 6e |olean Do|CloseWin|
|00004bf0| 64 6f 77 28 77 69 6e 64 | 6f 77 29 0d 09 57 69 6e |dow(wind|ow)..Win|
|00004c00| 64 6f 77 50 74 72 09 77 | 69 6e 64 6f 77 3b 0d 7b |dowPtr.w|indow;.{|
|00004c10| 0d 09 69 66 20 28 20 49 | 73 44 41 57 69 6e 64 6f |..if ( I|sDAWindo|
|00004c20| 77 28 77 69 6e 64 6f 77 | 29 20 29 0d 09 09 43 6c |w(window|) )...Cl|
|00004c30| 6f 73 65 44 65 73 6b 41 | 63 63 28 28 28 57 69 6e |oseDeskA|cc(((Win|
|00004c40| 64 6f 77 50 65 65 6b 29 | 20 77 69 6e 64 6f 77 29 |dowPeek)| window)|
|00004c50| 2d 3e 77 69 6e 64 6f 77 | 4b 69 6e 64 29 3b 0d 09 |->window|Kind);..|
|00004c60| 65 6c 73 65 20 69 66 20 | 28 20 49 73 41 70 70 57 |else if |( IsAppW|
|00004c70| 69 6e 64 6f 77 28 77 69 | 6e 64 6f 77 29 20 29 0d |indow(wi|ndow) ).|
|00004c80| 09 09 43 6c 6f 73 65 57 | 69 6e 64 6f 77 28 77 69 |..CloseW|indow(wi|
|00004c90| 6e 64 6f 77 29 3b 0d 09 | 72 65 74 75 72 6e 20 74 |ndow);..|return t|
|00004ca0| 72 75 65 3b 0d 7d 20 2f | 2a 44 6f 43 6c 6f 73 65 |rue;.} /|*DoClose|
|00004cb0| 57 69 6e 64 6f 77 2a 2f | 0d 0d 0d 2f 2a 2a 2a 2a |Window*/|.../****|
|00004cc0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004cd0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004ce0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004cf0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d00| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004d10| 2a 2a 0d 2a 2a 2a 20 31 | 2e 30 31 20 44 6f 43 6c |**.*** 1|.01 DoCl|
|00004d20| 6f 73 65 42 65 68 69 6e | 64 28 77 69 6e 64 6f 77 |oseBehin|d(window|
|00004d30| 29 20 77 61 73 20 72 65 | 6d 6f 76 65 64 20 2a 2a |) was re|moved **|
|00004d40| 2a 0d 0d 09 31 2e 30 31 | 20 2d 20 44 6f 43 6c 6f |*...1.01| - DoClo|
|00004d50| 73 65 42 65 68 69 6e 64 | 20 77 61 73 20 61 20 67 |seBehind| was a g|
|00004d60| 6f 6f 64 20 69 64 65 61 | 20 66 6f 72 20 63 6c 6f |ood idea| for clo|
|00004d70| 73 69 6e 67 20 77 69 6e | 64 6f 77 73 20 77 68 65 |sing win|dows whe|
|00004d80| 6e 20 71 75 69 74 74 69 | 6e 67 0d 09 61 6e 64 20 |n quitti|ng..and |
|00004d90| 6e 6f 74 20 68 61 76 69 | 6e 67 20 74 6f 20 77 6f |not havi|ng to wo|
|00004da0| 72 72 79 20 61 62 6f 75 | 74 20 75 70 64 61 74 69 |rry abou|t updati|
|00004db0| 6e 67 20 74 68 65 20 77 | 69 6e 64 6f 77 73 2c 20 |ng the w|indows, |
|00004dc0| 62 75 74 20 69 74 20 73 | 75 66 66 65 72 65 64 0d |but it s|uffered.|
|00004dd0| 09 66 72 6f 6d 20 61 20 | 66 61 74 61 6c 20 66 6c |.from a |fatal fl|
|00004de0| 61 77 2e 20 49 66 20 61 | 20 64 65 73 6b 20 61 63 |aw. If a| desk ac|
|00004df0| 63 65 73 73 6f 72 79 20 | 6f 77 6e 65 64 20 74 77 |cessory |owned tw|
|00004e00| 6f 20 77 69 6e 64 6f 77 | 73 2c 20 69 74 20 77 6f |o window|s, it wo|
|00004e10| 75 6c 64 0d 09 63 6c 6f | 73 65 20 62 6f 74 68 20 |uld..clo|se both |
|00004e20| 74 68 6f 73 65 20 77 69 | 6e 64 6f 77 73 20 77 68 |those wi|ndows wh|
|00004e30| 65 6e 20 43 6c 6f 73 65 | 44 65 73 6b 41 63 63 20 |en Close|DeskAcc |
|00004e40| 77 61 73 20 63 61 6c 6c | 65 64 2e 20 57 68 65 6e |was call|ed. When|
|00004e50| 20 44 6f 43 6c 6f 73 65 | 42 65 68 69 6e 64 0d 09 | DoClose|Behind..|
|00004e60| 67 6f 74 20 61 72 6f 75 | 6e 64 20 74 6f 20 63 61 |got arou|nd to ca|
|00004e70| 6c 6c 69 6e 67 20 44 6f | 43 6c 6f 73 65 57 69 6e |lling Do|CloseWin|
|00004e80| 64 6f 77 20 66 6f 72 20 | 74 68 61 74 20 6f 74 68 |dow for |that oth|
|00004e90| 65 72 20 77 69 6e 64 6f | 77 20 74 68 61 74 20 77 |er windo|w that w|
|00004ea0| 61 73 20 61 6c 72 65 61 | 64 79 0d 09 63 6c 6f 73 |as alrea|dy..clos|
|00004eb0| 65 64 2c 20 74 68 69 6e | 67 73 20 77 6f 75 6c 64 |ed, thin|gs would|
|00004ec0| 20 67 6f 20 76 65 72 79 | 20 70 6f 6f 72 6c 79 2e | go very| poorly.|
|00004ed0| 20 41 6e 6f 74 68 65 72 | 20 6f 70 74 69 6f 6e 20 | Another| option |
|00004ee0| 77 6f 75 6c 64 20 62 65 | 20 74 6f 20 68 61 76 65 |would be| to have|
|00004ef0| 20 61 0d 09 70 72 6f 63 | 65 64 75 72 65 2c 20 47 | a..proc|edure, G|
|00004f00| 65 74 52 65 61 72 57 69 | 6e 64 6f 77 2c 20 74 68 |etRearWi|ndow, th|
|00004f10| 61 74 20 77 6f 75 6c 64 | 20 67 6f 20 74 68 72 6f |at would| go thro|
|00004f20| 75 67 68 20 74 68 65 20 | 77 69 6e 64 6f 77 20 6c |ugh the |window l|
|00004f30| 69 73 74 20 61 6e 64 20 | 72 65 74 75 72 6e 0d 09 |ist and |return..|
|00004f40| 74 68 65 20 6c 61 73 74 | 20 77 69 6e 64 6f 77 2e |the last| window.|
|00004f50| 20 49 6e 73 74 65 61 64 | 2c 20 77 65 20 64 65 63 | Instead|, we dec|
|00004f60| 69 64 65 64 20 74 6f 20 | 70 72 65 73 65 6e 74 20 |ided to |present |
|00004f70| 74 68 65 20 73 74 61 6e | 64 61 72 64 20 61 70 70 |the stan|dard app|
|00004f80| 72 6f 61 63 68 0d 09 6f | 66 20 67 65 74 74 69 6e |roach..o|f gettin|
|00004f90| 67 20 61 6e 64 20 63 6c | 6f 73 69 6e 67 20 46 72 |g and cl|osing Fr|
|00004fa0| 6f 6e 74 57 69 6e 64 6f | 77 20 75 6e 74 69 6c 20 |ontWindo|w until |
|00004fb0| 46 72 6f 6e 74 57 69 6e | 64 6f 77 20 72 65 74 75 |FrontWin|dow retu|
|00004fc0| 72 6e 73 20 4e 49 4c 2e | 20 54 68 69 73 0d 09 68 |rns NIL.| This..h|
|00004fd0| 61 73 20 61 20 70 6f 74 | 65 6e 74 69 61 6c 20 62 |as a pot|ential b|
|00004fe0| 65 6e 65 66 69 74 20 69 | 6e 20 74 68 61 74 20 74 |enefit i|n that t|
|00004ff0| 68 65 20 77 69 6e 64 6f | 77 20 77 68 6f 73 65 20 |he windo|w whose |
|00005000| 64 6f 63 75 6d 65 6e 74 | 20 6e 65 65 64 73 20 74 |document| needs t|
|00005010| 6f 20 62 65 20 73 61 76 | 65 64 0d 09 6d 61 79 20 |o be sav|ed..may |
|00005020| 62 65 20 76 69 73 69 62 | 6c 65 20 73 69 6e 63 65 |be visib|le since|
|00005030| 20 69 74 20 69 73 20 74 | 68 65 20 66 72 6f 6e 74 | it is t|he front|
|00005040| 20 77 69 6e 64 6f 77 2c | 20 74 68 65 72 65 66 6f | window,| therefo|
|00005050| 72 65 20 64 65 63 72 65 | 61 73 69 6e 67 20 74 68 |re decre|asing th|
|00005060| 65 0d 09 63 68 61 6e 63 | 65 20 6f 66 20 75 73 65 |e..chanc|e of use|
|00005070| 72 20 63 6f 6e 66 75 73 | 69 6f 6e 2e 20 46 6f 72 |r confus|ion. For|
|00005080| 20 61 65 73 74 68 65 74 | 69 63 20 72 65 61 73 6f | aesthet|ic reaso|
|00005090| 6e 73 2c 20 74 68 65 20 | 77 69 6e 64 6f 77 73 20 |ns, the |windows |
|000050a0| 69 6e 20 74 68 65 0d 09 | 61 70 70 6c 69 63 61 74 |in the..|applicat|
|000050b0| 69 6f 6e 20 73 68 6f 75 | 6c 64 20 62 65 20 63 68 |ion shou|ld be ch|
|000050c0| 65 63 6b 65 64 20 66 6f | 72 20 75 70 64 61 74 65 |ecked fo|r update|
|000050d0| 73 20 70 65 72 69 6f 64 | 69 63 61 6c 6c 79 20 61 |s period|ically a|
|000050e0| 6e 64 20 68 61 76 65 20 | 74 68 65 0d 09 75 70 64 |nd have |the..upd|
|000050f0| 61 74 65 73 20 73 65 72 | 76 69 63 65 64 2e 0d 2a |ates ser|viced..*|
|00005100| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005110| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005120| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005130| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005140| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00005150| 2a 2a 2a 2a 2a 2f 0d 0d | 0d 2f 2a 20 43 6c 65 61 |*****/..|./* Clea|
|00005160| 6e 20 75 70 20 74 68 65 | 20 61 70 70 6c 69 63 61 |n up the| applica|
|00005170| 74 69 6f 6e 20 61 6e 64 | 20 65 78 69 74 2e 20 57 |tion and| exit. W|
|00005180| 65 20 63 6c 6f 73 65 20 | 61 6c 6c 20 6f 66 20 74 |e close |all of t|
|00005190| 68 65 20 77 69 6e 64 6f | 77 73 20 73 6f 20 74 68 |he windo|ws so th|
|000051a0| 61 74 0d 20 74 68 65 79 | 20 63 61 6e 20 75 70 64 |at. they| can upd|
|000051b0| 61 74 65 20 74 68 65 69 | 72 20 64 6f 63 75 6d 65 |ate thei|r docume|
|000051c0| 6e 74 73 2c 20 69 66 20 | 61 6e 79 2e 20 2a 2f 0d |nts, if |any. */.|
|000051d0| 20 0d 2f 2a 09 31 2e 30 | 31 20 2d 20 49 66 20 77 | ./*.1.0|1 - If w|
|000051e0| 65 20 66 69 6e 64 20 6f | 75 74 20 74 68 61 74 20 |e find o|ut that |
|000051f0| 61 20 63 61 6e 63 65 6c | 20 68 61 73 20 6f 63 63 |a cancel| has occ|
|00005200| 75 72 72 65 64 2c 20 77 | 65 20 77 6f 6e 27 74 20 |urred, w|e won't |
|00005210| 65 78 69 74 20 74 6f 20 | 74 68 65 0d 09 73 68 65 |exit to |the..she|
|00005220| 6c 6c 2c 20 62 75 74 20 | 77 69 6c 6c 20 72 65 74 |ll, but |will ret|
|00005230| 75 72 6e 20 69 6e 73 74 | 65 61 64 2e 20 2a 2f 0d |urn inst|ead. */.|
|00005240| 0d 23 70 72 61 67 6d 61 | 20 73 65 67 6d 65 6e 74 |.#pragma| segment|
|00005250| 20 4d 61 69 6e 0d 76 6f | 69 64 20 54 65 72 6d 69 | Main.vo|id Termi|
|00005260| 6e 61 74 65 28 29 0d 7b | 0d 09 57 69 6e 64 6f 77 |nate().{|..Window|
|00005270| 50 74 72 09 61 57 69 6e | 64 6f 77 3b 0d 09 42 6f |Ptr.aWin|dow;..Bo|
|00005280| 6f 6c 65 61 6e 09 09 63 | 6c 6f 73 65 64 3b 0d 09 |olean..c|losed;..|
|00005290| 0d 09 63 6c 6f 73 65 64 | 20 3d 20 74 72 75 65 3b |..closed| = true;|
|000052a0| 0d 09 64 6f 20 7b 0d 09 | 09 61 57 69 6e 64 6f 77 |..do {..|.aWindow|
|000052b0| 20 3d 20 46 72 6f 6e 74 | 57 69 6e 64 6f 77 28 29 | = Front|Window()|
|000052c0| 3b 09 09 09 09 2f 2a 20 | 67 65 74 20 74 68 65 20 |;..../* |get the |
|000052d0| 63 75 72 72 65 6e 74 20 | 66 72 6f 6e 74 20 77 69 |current |front wi|
|000052e0| 6e 64 6f 77 20 2a 2f 0d | 09 09 69 66 20 28 61 57 |ndow */.|..if (aW|
|000052f0| 69 6e 64 6f 77 20 21 3d | 20 6e 69 6c 29 0d 09 09 |indow !=| nil)...|
|00005300| 09 63 6c 6f 73 65 64 20 | 3d 20 44 6f 43 6c 6f 73 |.closed |= DoClos|
|00005310| 65 57 69 6e 64 6f 77 28 | 61 57 69 6e 64 6f 77 29 |eWindow(|aWindow)|
|00005320| 3b 09 2f 2a 20 63 6c 6f | 73 65 20 74 68 69 73 20 |;./* clo|se this |
|00005330| 77 69 6e 64 6f 77 20 2a | 2f 09 0d 09 7d 0d 09 77 |window *|/...}..w|
|00005340| 68 69 6c 65 20 28 63 6c | 6f 73 65 64 20 26 26 20 |hile (cl|osed && |
|00005350| 28 61 57 69 6e 64 6f 77 | 20 21 3d 20 6e 69 6c 29 |(aWindow| != nil)|
|00005360| 29 3b 0d 09 69 66 20 28 | 63 6c 6f 73 65 64 29 0d |);..if (|closed).|
|00005370| 09 09 45 78 69 74 54 6f | 53 68 65 6c 6c 28 29 3b |..ExitTo|Shell();|
|00005380| 09 09 09 09 09 09 09 2f | 2a 20 65 78 69 74 20 69 |......./|* exit i|
|00005390| 66 20 6e 6f 20 63 61 6e | 63 65 6c 6c 61 74 69 6f |f no can|cellatio|
|000053a0| 6e 20 2a 2f 0d 7d 20 2f | 2a 54 65 72 6d 69 6e 61 |n */.} /|*Termina|
|000053b0| 74 65 2a 2f 0d 0d 0d 2f | 2a 09 53 65 74 20 75 70 |te*/.../|*.Set up|
|000053c0| 20 74 68 65 20 77 68 6f | 6c 65 20 77 6f 72 6c 64 | the who|le world|
|000053d0| 2c 20 69 6e 63 6c 75 64 | 69 6e 67 20 67 6c 6f 62 |, includ|ing glob|
|000053e0| 61 6c 20 76 61 72 69 61 | 62 6c 65 73 2c 20 54 6f |al varia|bles, To|
|000053f0| 6f 6c 62 6f 78 20 6d 61 | 6e 61 67 65 72 73 2c 0d |olbox ma|nagers,.|
|00005400| 09 61 6e 64 20 6d 65 6e | 75 73 2e 20 57 65 20 61 |.and men|us. We a|
|00005410| 6c 73 6f 20 63 72 65 61 | 74 65 20 6f 75 72 20 6f |lso crea|te our o|
|00005420| 6e 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 77 |ne appli|cation w|
|00005430| 69 6e 64 6f 77 20 61 74 | 20 74 68 69 73 20 74 69 |indow at| this ti|
|00005440| 6d 65 2e 0d 09 53 69 6e | 63 65 20 77 69 6e 64 6f |me...Sin|ce windo|
|00005450| 77 20 73 74 6f 72 61 67 | 65 20 69 73 20 6e 6f 6e |w storag|e is non|
|00005460| 2d 72 65 6c 6f 63 61 74 | 65 61 62 6c 65 2c 20 68 |-relocat|eable, h|
|00005470| 6f 77 20 61 6e 64 20 77 | 68 65 6e 20 74 6f 20 61 |ow and w|hen to a|
|00005480| 6c 6c 6f 63 61 74 65 20 | 73 70 61 63 65 0d 09 66 |llocate |space..f|
|00005490| 6f 72 20 77 69 6e 64 6f | 77 73 20 69 73 20 76 65 |or windo|ws is ve|
|000054a0| 72 79 20 69 6d 70 6f 72 | 74 61 6e 74 20 73 6f 20 |ry impor|tant so |
|000054b0| 74 68 61 74 20 68 65 61 | 70 20 66 72 61 67 6d 65 |that hea|p fragme|
|000054c0| 6e 74 61 74 69 6f 6e 20 | 64 6f 65 73 20 6e 6f 74 |ntation |does not|
|000054d0| 20 6f 63 63 75 72 2e 0d | 09 42 65 63 61 75 73 65 | occur..|.Because|
|000054e0| 20 53 61 6d 70 6c 65 20 | 68 61 73 20 6f 6e 6c 79 | Sample |has only|
|000054f0| 20 6f 6e 65 20 77 69 6e | 64 6f 77 20 61 6e 64 20 | one win|dow and |
|00005500| 69 74 20 69 73 20 6f 6e | 6c 79 20 64 69 73 70 6f |it is on|ly dispo|
|00005510| 73 65 64 20 77 68 65 6e | 20 74 68 65 20 61 70 70 |sed when| the app|
|00005520| 6c 69 63 61 74 69 6f 6e | 0d 09 71 75 69 74 73 2c |lication|..quits,|
|00005530| 20 77 65 20 77 69 6c 6c | 20 61 6c 6c 6f 63 61 74 | we will| allocat|
|00005540| 65 20 69 74 73 20 73 70 | 61 63 65 20 68 65 72 65 |e its sp|ace here|
|00005550| 2c 20 62 65 66 6f 72 65 | 20 61 6e 79 74 68 69 6e |, before| anythin|
|00005560| 67 20 74 68 61 74 20 6d | 69 67 68 74 20 62 65 20 |g that m|ight be |
|00005570| 61 20 6c 6f 63 6b 65 64 | 0d 09 72 65 6c 6f 63 61 |a locked|..reloca|
|00005580| 74 61 62 6c 65 20 6f 62 | 6a 65 63 74 20 67 65 74 |table ob|ject get|
|00005590| 73 20 69 6e 74 6f 20 74 | 68 65 20 68 65 61 70 2e |s into t|he heap.|
|000055a0| 20 54 68 69 73 20 77 61 | 79 2c 20 77 65 20 63 61 | This wa|y, we ca|
|000055b0| 6e 20 66 6f 72 63 65 20 | 74 68 65 20 73 74 6f 72 |n force |the stor|
|000055c0| 61 67 65 20 74 6f 20 62 | 65 0d 09 69 6e 20 74 68 |age to b|e..in th|
|000055d0| 65 20 6c 6f 77 65 73 74 | 20 6d 65 6d 6f 72 79 20 |e lowest| memory |
|000055e0| 61 76 61 69 6c 61 62 6c | 65 20 69 6e 20 74 68 65 |availabl|e in the|
|000055f0| 20 68 65 61 70 2e 20 57 | 69 6e 64 6f 77 20 73 74 | heap. W|indow st|
|00005600| 6f 72 61 67 65 20 63 61 | 6e 20 64 69 66 66 65 72 |orage ca|n differ|
|00005610| 20 77 69 64 65 6c 79 0d | 09 61 6d 6f 6e 67 73 74 | widely.|.amongst|
|00005620| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 73 20 64 65 | applica|tions de|
|00005630| 70 65 6e 64 69 6e 67 20 | 6f 6e 20 68 6f 77 20 6d |pending |on how m|
|00005640| 61 6e 79 20 77 69 6e 64 | 6f 77 73 20 61 72 65 20 |any wind|ows are |
|00005650| 63 72 65 61 74 65 64 20 | 61 6e 64 20 64 69 73 70 |created |and disp|
|00005660| 6f 73 65 64 2e 20 2a 2f | 0d 0d 2f 2a 09 31 2e 30 |osed. */|../*.1.0|
|00005670| 31 20 2d 20 54 68 65 20 | 63 6f 64 65 20 74 68 61 |1 - The |code tha|
|00005680| 74 20 75 73 65 64 20 74 | 6f 20 62 65 20 70 61 72 |t used t|o be par|
|00005690| 74 20 6f 66 20 46 6f 72 | 63 65 45 6e 76 69 72 6f |t of For|ceEnviro|
|000056a0| 6e 73 20 68 61 73 20 62 | 65 65 6e 20 6d 6f 76 65 |ns has b|een move|
|000056b0| 64 20 69 6e 74 6f 0d 09 | 74 68 69 73 20 6d 6f 64 |d into..|this mod|
|000056c0| 75 6c 65 2e 20 49 66 20 | 61 6e 20 65 72 72 6f 72 |ule. If |an error|
|000056d0| 20 69 73 20 64 65 74 65 | 63 74 65 64 2c 20 69 6e | is dete|cted, in|
|000056e0| 73 74 65 61 64 20 6f 66 | 20 6d 65 72 65 6c 79 20 |stead of| merely |
|000056f0| 64 6f 69 6e 67 20 61 6e | 20 45 78 69 74 54 6f 53 |doing an| ExitToS|
|00005700| 68 65 6c 6c 2c 0d 09 77 | 68 69 63 68 20 6c 65 61 |hell,..w|hich lea|
|00005710| 76 65 73 20 74 68 65 20 | 75 73 65 72 20 77 69 74 |ves the |user wit|
|00005720| 68 6f 75 74 20 6d 75 63 | 68 20 74 6f 20 67 6f 20 |hout muc|h to go |
|00005730| 6f 6e 2c 20 77 65 20 63 | 61 6c 6c 20 41 6c 65 72 |on, we c|all Aler|
|00005740| 74 55 73 65 72 2c 20 77 | 68 69 63 68 20 70 75 74 |tUser, w|hich put|
|00005750| 73 0d 09 75 70 20 61 20 | 73 69 6d 70 6c 65 20 61 |s..up a |simple a|
|00005760| 6c 65 72 74 20 74 68 61 | 74 20 6a 75 73 74 20 73 |lert tha|t just s|
|00005770| 61 79 73 20 61 6e 20 65 | 72 72 6f 72 20 6f 63 63 |ays an e|rror occ|
|00005780| 75 72 72 65 64 20 61 6e | 64 20 74 68 65 6e 20 63 |urred an|d then c|
|00005790| 61 6c 6c 73 20 45 78 69 | 74 54 6f 53 68 65 6c 6c |alls Exi|tToShell|
|000057a0| 2e 0d 09 53 69 6e 63 65 | 20 74 68 65 72 65 20 69 |...Since| there i|
|000057b0| 73 20 6e 6f 20 6f 74 68 | 65 72 20 63 6c 65 61 6e |s no oth|er clean|
|000057c0| 75 70 20 6e 65 65 64 65 | 64 20 61 74 20 74 68 69 |up neede|d at thi|
|000057d0| 73 20 70 6f 69 6e 74 20 | 69 66 20 61 6e 20 65 72 |s point |if an er|
|000057e0| 72 6f 72 20 69 73 20 64 | 65 74 65 63 74 65 64 2c |ror is d|etected,|
|000057f0| 0d 09 74 68 69 73 20 66 | 6f 72 6d 20 6f 66 20 65 |..this f|orm of e|
|00005800| 72 72 6f 72 2d 20 68 61 | 6e 64 6c 69 6e 67 20 69 |rror- ha|ndling i|
|00005810| 73 20 61 63 63 65 70 74 | 61 62 6c 65 2e 20 49 66 |s accept|able. If|
|00005820| 20 6d 6f 72 65 20 73 6f | 70 68 69 73 74 69 63 61 | more so|phistica|
|00005830| 74 65 64 20 65 72 72 6f | 72 20 72 65 63 6f 76 65 |ted erro|r recove|
|00005840| 72 79 0d 09 69 73 20 6e | 65 65 64 65 64 2c 20 61 |ry..is n|eeded, a|
|00005850| 6e 20 65 78 63 65 70 74 | 69 6f 6e 20 6d 65 63 68 |n except|ion mech|
|00005860| 61 6e 69 73 6d 2c 20 73 | 75 63 68 20 61 73 20 69 |anism, s|uch as i|
|00005870| 73 20 70 72 6f 76 69 64 | 65 64 20 62 79 20 53 69 |s provid|ed by Si|
|00005880| 67 6e 61 6c 73 2c 20 63 | 61 6e 20 62 65 20 75 73 |gnals, c|an be us|
|00005890| 65 64 2e 20 2a 2f 0d 0d | 23 70 72 61 67 6d 61 20 |ed. */..|#pragma |
|000058a0| 73 65 67 6d 65 6e 74 20 | 49 6e 69 74 69 61 6c 69 |segment |Initiali|
|000058b0| 7a 65 0d 76 6f 69 64 20 | 49 6e 69 74 69 61 6c 69 |ze.void |Initiali|
|000058c0| 7a 65 28 29 0d 7b 0d 09 | 48 61 6e 64 6c 65 09 09 |ze().{..|Handle..|
|000058d0| 6d 65 6e 75 42 61 72 3b | 0d 09 57 69 6e 64 6f 77 |menuBar;|..Window|
|000058e0| 50 74 72 09 77 69 6e 64 | 6f 77 3b 0d 09 6c 6f 6e |Ptr.wind|ow;..lon|
|000058f0| 67 09 09 74 6f 74 61 6c | 2c 20 63 6f 6e 74 69 67 |g..total|, contig|
|00005900| 3b 0d 09 45 76 65 6e 74 | 52 65 63 6f 72 64 20 65 |;..Event|Record e|
|00005910| 76 65 6e 74 3b 0d 09 73 | 68 6f 72 74 09 09 63 6f |vent;..s|hort..co|
|00005920| 75 6e 74 3b 0d 0d 09 67 | 49 6e 42 61 63 6b 67 72 |unt;...g|InBackgr|
|00005930| 6f 75 6e 64 20 3d 20 66 | 61 6c 73 65 3b 0d 0d 09 |ound = f|alse;...|
|00005940| 49 6e 69 74 47 72 61 66 | 28 28 50 74 72 29 20 26 |InitGraf|((Ptr) &|
|00005950| 71 64 2e 74 68 65 50 6f | 72 74 29 3b 0d 09 49 6e |qd.thePo|rt);..In|
|00005960| 69 74 46 6f 6e 74 73 28 | 29 3b 0d 09 49 6e 69 74 |itFonts(|);..Init|
|00005970| 57 69 6e 64 6f 77 73 28 | 29 3b 0d 09 49 6e 69 74 |Windows(|);..Init|
|00005980| 4d 65 6e 75 73 28 29 3b | 0d 09 54 45 49 6e 69 74 |Menus();|..TEInit|
|00005990| 28 29 3b 0d 09 49 6e 69 | 74 44 69 61 6c 6f 67 73 |();..Ini|tDialogs|
|000059a0| 28 6e 69 6c 29 3b 0d 09 | 49 6e 69 74 43 75 72 73 |(nil);..|InitCurs|
|000059b0| 6f 72 28 29 3b 0d 09 0d | 09 2f 2a 09 43 61 6c 6c |or();...|./*.Call|
|000059c0| 20 4d 50 50 4f 70 65 6e | 20 61 6e 64 20 41 54 50 | MPPOpen| and ATP|
|000059d0| 4c 6f 61 64 20 61 74 20 | 74 68 69 73 20 70 6f 69 |Load at |this poi|
|000059e0| 6e 74 20 74 6f 20 69 6e | 69 74 69 61 6c 69 7a 65 |nt to in|itialize|
|000059f0| 20 41 70 70 6c 65 54 61 | 6c 6b 2c 0d 09 20 09 69 | AppleTa|lk,.. .i|
|00005a00| 66 20 79 6f 75 20 61 72 | 65 20 75 73 69 6e 67 20 |f you ar|e using |
|00005a10| 69 74 2e 20 2a 2f 0d 09 | 2f 2a 09 4e 4f 54 45 20 |it. */..|/*.NOTE |
|00005a20| 2d 2d 20 49 74 20 69 73 | 20 6e 6f 20 6c 6f 6e 67 |-- It is| no long|
|00005a30| 65 72 20 6e 65 63 65 73 | 73 61 72 79 2c 20 61 6e |er neces|sary, an|
|00005a40| 64 20 61 63 74 75 61 6c | 6c 79 20 75 6e 68 65 61 |d actual|ly unhea|
|00005a50| 6c 74 68 79 2c 20 74 6f | 20 63 68 65 63 6b 0d 09 |lthy, to| check..|
|00005a60| 09 50 6f 72 74 42 55 73 | 65 20 61 6e 64 20 53 50 |.PortBUs|e and SP|
|00005a70| 43 6f 6e 66 69 67 20 62 | 65 66 6f 72 65 20 6f 70 |Config b|efore op|
|00005a80| 65 6e 69 6e 67 20 41 70 | 70 6c 65 54 61 6c 6b 2e |ening Ap|pleTalk.|
|00005a90| 20 54 68 65 20 64 72 69 | 76 65 72 73 20 61 72 65 | The dri|vers are|
|00005aa0| 20 63 61 70 61 62 6c 65 | 0d 09 09 6f 66 20 63 68 | capable|...of ch|
|00005ab0| 65 63 6b 69 6e 67 20 66 | 6f 72 20 70 6f 72 74 20 |ecking f|or port |
|00005ac0| 61 76 61 69 6c 61 62 69 | 6c 69 74 79 20 74 68 65 |availabi|lity the|
|00005ad0| 6d 73 65 6c 76 65 73 2e | 20 2a 2f 0d 09 0d 09 2f |mselves.| */..../|
|00005ae0| 2a 09 54 68 69 73 20 6e | 65 78 74 20 62 69 74 20 |*.This n|ext bit |
|00005af0| 6f 66 20 63 6f 64 65 20 | 69 73 20 6e 65 63 65 73 |of code |is neces|
|00005b00| 73 61 72 79 20 74 6f 20 | 61 6c 6c 6f 77 20 74 68 |sary to |allow th|
|00005b10| 65 20 64 65 66 61 75 6c | 74 20 62 75 74 74 6f 6e |e defaul|t button|
|00005b20| 20 6f 66 20 6f 75 72 0d | 09 09 61 6c 65 72 74 20 | of our.|..alert |
|00005b30| 62 65 20 6f 75 74 6c 69 | 6e 65 64 2e 0d 09 09 31 |be outli|ned....1|
|00005b40| 2e 30 32 20 2d 20 43 68 | 61 6e 67 65 64 20 74 6f |.02 - Ch|anged to|
|00005b50| 20 63 61 6c 6c 20 45 76 | 65 6e 74 41 76 61 69 6c | call Ev|entAvail|
|00005b60| 20 73 6f 20 74 68 61 74 | 20 77 65 20 64 6f 6e 27 | so that| we don'|
|00005b70| 74 20 6c 6f 73 65 20 73 | 6f 6d 65 20 69 6d 70 6f |t lose s|ome impo|
|00005b80| 72 74 61 6e 74 0d 09 09 | 65 76 65 6e 74 73 2e 20 |rtant...|events. |
|00005b90| 2a 2f 0d 09 20 0d 09 66 | 6f 72 20 28 63 6f 75 6e |*/.. ..f|or (coun|
|00005ba0| 74 20 3d 20 31 3b 20 63 | 6f 75 6e 74 20 3c 3d 20 |t = 1; c|ount <= |
|00005bb0| 33 3b 20 63 6f 75 6e 74 | 2b 2b 29 0d 09 09 45 76 |3; count|++)...Ev|
|00005bc0| 65 6e 74 41 76 61 69 6c | 28 65 76 65 72 79 45 76 |entAvail|(everyEv|
|00005bd0| 65 6e 74 2c 20 26 65 76 | 65 6e 74 29 3b 0d 09 0d |ent, &ev|ent);...|
|00005be0| 09 2f 2a 09 49 67 6e 6f | 72 65 20 74 68 65 20 65 |./*.Igno|re the e|
|00005bf0| 72 72 6f 72 20 72 65 74 | 75 72 6e 65 64 20 66 72 |rror ret|urned fr|
|00005c00| 6f 6d 20 53 79 73 45 6e | 76 69 72 6f 6e 73 3b 20 |om SysEn|virons; |
|00005c10| 65 76 65 6e 20 69 66 20 | 61 6e 20 65 72 72 6f 72 |even if |an error|
|00005c20| 20 6f 63 63 75 72 72 65 | 64 2c 0d 09 09 74 68 65 | occurre|d,...the|
|00005c30| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 20 67 6c 75 | SysEnvi|rons glu|
|00005c40| 65 20 77 69 6c 6c 20 66 | 69 6c 6c 20 69 6e 20 74 |e will f|ill in t|
|00005c50| 68 65 20 53 79 73 45 6e | 76 52 65 63 2e 20 59 6f |he SysEn|vRec. Yo|
|00005c60| 75 20 63 61 6e 20 73 61 | 76 65 20 61 20 72 65 64 |u can sa|ve a red|
|00005c70| 75 6e 64 61 6e 74 0d 09 | 09 63 61 6c 6c 20 74 6f |undant..|.call to|
|00005c80| 20 53 79 73 45 6e 76 69 | 72 6f 6e 73 20 62 79 20 | SysEnvi|rons by |
|00005c90| 63 61 6c 6c 69 6e 67 20 | 69 74 20 61 66 74 65 72 |calling |it after|
|00005ca0| 20 69 6e 69 74 69 61 6c | 69 7a 69 6e 67 20 41 70 | initial|izing Ap|
|00005cb0| 70 6c 65 54 61 6c 6b 2e | 20 2a 2f 0d 09 20 0d 09 |pleTalk.| */.. ..|
|00005cc0| 53 79 73 45 6e 76 69 72 | 6f 6e 73 28 6b 53 79 73 |SysEnvir|ons(kSys|
|00005cd0| 45 6e 76 69 72 6f 6e 73 | 56 65 72 73 69 6f 6e 2c |Environs|Version,|
|00005ce0| 20 26 67 4d 61 63 29 3b | 0d 09 0d 09 2f 2a 20 4d | &gMac);|..../* M|
|00005cf0| 61 6b 65 20 73 75 72 65 | 20 74 68 61 74 20 74 68 |ake sure| that th|
|00005d00| 65 20 6d 61 63 68 69 6e | 65 20 68 61 73 20 61 74 |e machin|e has at|
|00005d10| 20 6c 65 61 73 74 20 31 | 32 38 4b 20 52 4f 4d 73 | least 1|28K ROMs|
|00005d20| 2e 20 49 66 20 69 74 20 | 64 6f 65 73 6e 27 74 2c |. If it |doesn't,|
|00005d30| 20 65 78 69 74 2e 20 2a | 2f 0d 09 0d 09 69 66 20 | exit. *|/....if |
|00005d40| 28 67 4d 61 63 2e 6d 61 | 63 68 69 6e 65 54 79 70 |(gMac.ma|chineTyp|
|00005d50| 65 20 3c 20 30 29 20 41 | 6c 65 72 74 55 73 65 72 |e < 0) A|lertUser|
|00005d60| 28 29 3b 0d 09 0d 09 2f | 2a 09 31 2e 30 32 20 2d |();..../|*.1.02 -|
|00005d70| 20 4d 6f 76 65 20 54 72 | 61 70 41 76 61 69 6c 61 | Move Tr|apAvaila|
|00005d80| 62 6c 65 20 63 61 6c 6c | 20 74 6f 20 61 66 74 65 |ble call| to afte|
|00005d90| 72 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 73 6f |r SysEnv|irons so|
|00005da0| 20 74 68 61 74 20 77 65 | 20 63 61 6e 20 74 65 6c | that we| can tel|
|00005db0| 6c 0d 09 09 69 6e 20 54 | 72 61 70 41 76 61 69 6c |l...in T|rapAvail|
|00005dc0| 61 62 6c 65 20 69 66 20 | 61 20 74 6f 6f 6c 20 74 |able if |a tool t|
|00005dd0| 72 61 70 20 76 61 6c 75 | 65 20 69 73 20 6f 75 74 |rap valu|e is out|
|00005de0| 20 6f 66 20 72 61 6e 67 | 65 2e 20 2a 2f 0d 09 09 | of rang|e. */...|
|00005df0| 0d 09 67 48 61 73 57 61 | 69 74 4e 65 78 74 45 76 |..gHasWa|itNextEv|
|00005e00| 65 6e 74 20 3d 20 54 72 | 61 70 41 76 61 69 6c 61 |ent = Tr|apAvaila|
|00005e10| 62 6c 65 28 5f 57 61 69 | 74 4e 65 78 74 45 76 65 |ble(_Wai|tNextEve|
|00005e20| 6e 74 2c 20 54 6f 6f 6c | 54 72 61 70 29 3b 0d 0d |nt, Tool|Trap);..|
|00005e30| 09 2f 2a 09 31 2e 30 31 | 20 2d 20 57 65 20 75 73 |./*.1.01| - We us|
|00005e40| 65 64 20 74 6f 20 6d 61 | 6b 65 20 61 20 63 68 65 |ed to ma|ke a che|
|00005e50| 63 6b 20 66 6f 72 20 6d | 65 6d 6f 72 79 20 61 74 |ck for m|emory at|
|00005e60| 20 74 68 69 73 20 70 6f | 69 6e 74 20 62 79 20 65 | this po|int by e|
|00005e70| 78 61 6d 69 6e 69 6e 67 | 20 41 70 70 6c 4c 69 6d |xamining| ApplLim|
|00005e80| 69 74 2c 0d 09 09 41 70 | 70 6c 69 63 5a 6f 6e 65 |it,...Ap|plicZone|
|00005e90| 2c 20 61 6e 64 20 53 74 | 61 63 6b 53 70 61 63 65 |, and St|ackSpace|
|00005ea0| 20 61 6e 64 20 63 6f 6d | 70 61 72 69 6e 67 20 74 | and com|paring t|
|00005eb0| 68 61 74 20 74 6f 20 74 | 68 65 20 6d 69 6e 69 6d |hat to t|he minim|
|00005ec0| 75 6d 20 73 69 7a 65 20 | 77 65 20 74 6f 6c 64 0d |um size |we told.|
|00005ed0| 09 09 4d 75 6c 74 69 46 | 69 6e 64 65 72 20 77 65 |..MultiF|inder we|
|00005ee0| 20 6e 65 65 64 65 64 2e | 20 54 68 69 73 20 64 69 | needed.| This di|
|00005ef0| 64 20 6e 6f 74 20 77 6f | 72 6b 20 77 65 6c 6c 20 |d not wo|rk well |
|00005f00| 62 65 63 61 75 73 65 20 | 69 74 20 61 73 73 75 6d |because |it assum|
|00005f10| 65 64 20 74 6f 6f 20 6d | 75 63 68 20 61 62 6f 75 |ed too m|uch abou|
|00005f20| 74 0d 09 09 74 68 65 20 | 72 65 6c 61 74 69 6f 6e |t...the |relation|
|00005f30| 73 68 69 70 20 62 65 74 | 77 65 65 6e 20 77 68 61 |ship bet|ween wha|
|00005f40| 74 20 77 65 20 61 73 6b | 65 64 20 4d 75 6c 74 69 |t we ask|ed Multi|
|00005f50| 46 69 6e 64 65 72 20 66 | 6f 72 20 61 6e 64 20 77 |Finder f|or and w|
|00005f60| 68 61 74 20 77 65 20 77 | 6f 75 6c 64 20 61 63 74 |hat we w|ould act|
|00005f70| 75 61 6c 6c 79 0d 09 09 | 67 65 74 20 62 61 63 6b |ually...|get back|
|00005f80| 2c 20 61 73 20 77 65 6c | 6c 20 61 73 20 68 6f 77 |, as wel|l as how|
|00005f90| 20 74 6f 20 6d 65 61 73 | 75 72 65 20 69 74 2e 20 | to meas|ure it. |
|00005fa0| 49 6e 73 74 65 61 64 2c | 20 77 65 20 77 69 6c 6c |Instead,| we will|
|00005fb0| 20 75 73 65 20 61 6e 20 | 61 6c 74 65 72 6e 61 74 | use an |alternat|
|00005fc0| 65 0d 09 09 6d 65 74 68 | 6f 64 20 63 6f 6d 70 72 |e...meth|od compr|
|00005fd0| 69 73 65 64 20 6f 66 20 | 74 77 6f 20 73 74 65 70 |ised of |two step|
|00005fe0| 73 2e 20 2a 2f 0d 09 20 | 0d 09 2f 2a 09 49 74 20 |s. */.. |../*.It |
|00005ff0| 69 73 20 62 65 74 74 65 | 72 20 74 6f 20 66 69 72 |is bette|r to fir|
|00006000| 73 74 20 63 68 65 63 6b | 20 74 68 65 20 73 69 7a |st check| the siz|
|00006010| 65 20 6f 66 20 74 68 65 | 20 61 70 70 6c 69 63 61 |e of the| applica|
|00006020| 74 69 6f 6e 20 68 65 61 | 70 20 61 67 61 69 6e 73 |tion hea|p agains|
|00006030| 74 20 61 20 76 61 6c 75 | 65 0d 09 09 74 68 61 74 |t a valu|e...that|
|00006040| 20 79 6f 75 20 68 61 76 | 65 20 64 65 74 65 72 6d | you hav|e determ|
|00006050| 69 6e 65 64 20 69 73 20 | 74 68 65 20 73 6d 61 6c |ined is |the smal|
|00006060| 6c 65 73 74 20 68 65 61 | 70 20 74 68 65 20 61 70 |lest hea|p the ap|
|00006070| 70 6c 69 63 61 74 69 6f | 6e 20 63 61 6e 20 72 65 |plicatio|n can re|
|00006080| 61 73 6f 6e 61 62 6c 79 | 0d 09 09 77 6f 72 6b 20 |asonably|...work |
|00006090| 69 6e 2e 20 54 68 69 73 | 20 6e 75 6d 62 65 72 20 |in. This| number |
|000060a0| 73 68 6f 75 6c 64 20 62 | 65 20 64 65 72 69 76 65 |should b|e derive|
|000060b0| 64 20 62 79 20 65 78 61 | 6d 69 6e 69 6e 67 20 74 |d by exa|mining t|
|000060c0| 68 65 20 73 69 7a 65 20 | 6f 66 20 74 68 65 20 68 |he size |of the h|
|000060d0| 65 61 70 20 74 68 61 74 | 0d 09 09 69 73 20 61 63 |eap that|...is ac|
|000060e0| 74 75 61 6c 6c 79 20 70 | 72 6f 76 69 64 65 64 20 |tually p|rovided |
|000060f0| 62 79 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 20 77 |by Multi|Finder w|
|00006100| 68 65 6e 20 74 68 65 20 | 6d 69 6e 69 6d 75 6d 20 |hen the |minimum |
|00006110| 73 69 7a 65 20 72 65 71 | 75 65 73 74 65 64 20 69 |size req|uested i|
|00006120| 73 20 75 73 65 64 2e 0d | 09 09 54 68 65 20 64 65 |s used..|..The de|
|00006130| 72 69 76 61 74 69 6f 6e | 20 6f 66 20 74 68 65 20 |rivation| of the |
|00006140| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 72 65 71 |minimum |size req|
|00006150| 75 65 73 74 65 64 20 66 | 72 6f 6d 20 4d 75 6c 74 |uested f|rom Mult|
|00006160| 69 46 69 6e 64 65 72 20 | 69 73 20 64 65 73 63 72 |iFinder |is descr|
|00006170| 69 62 65 64 0d 09 09 69 | 6e 20 53 61 6d 70 6c 65 |ibed...i|n Sample|
|00006180| 2e 68 2e 20 54 68 65 20 | 63 68 65 63 6b 20 73 68 |.h. The |check sh|
|00006190| 6f 75 6c 64 20 62 65 20 | 6d 61 64 65 20 62 65 63 |ould be |made bec|
|000061a0| 61 75 73 65 20 74 68 65 | 20 70 72 65 66 65 72 72 |ause the| preferr|
|000061b0| 65 64 20 73 69 7a 65 20 | 63 61 6e 20 65 6e 64 20 |ed size |can end |
|000061c0| 75 70 0d 09 09 62 65 69 | 6e 67 20 73 65 74 20 73 |up...bei|ng set s|
|000061d0| 6d 61 6c 6c 65 72 20 74 | 68 61 6e 20 74 68 65 20 |maller t|han the |
|000061e0| 6d 69 6e 69 6d 75 6d 20 | 73 69 7a 65 20 62 79 20 |minimum |size by |
|000061f0| 74 68 65 20 75 73 65 72 | 2e 20 54 68 69 73 20 65 |the user|. This e|
|00006200| 78 74 72 61 20 63 68 65 | 63 6b 20 61 63 74 73 20 |xtra che|ck acts |
|00006210| 74 6f 0d 09 09 69 6e 73 | 75 72 65 20 74 68 61 74 |to...ins|ure that|
|00006220| 20 79 6f 75 72 20 61 70 | 70 6c 69 63 61 74 69 6f | your ap|plicatio|
|00006230| 6e 20 69 73 20 73 74 61 | 72 74 69 6e 67 20 66 72 |n is sta|rting fr|
|00006240| 6f 6d 20 61 20 73 6f 6c | 69 64 20 6d 65 6d 6f 72 |om a sol|id memor|
|00006250| 79 20 66 6f 75 6e 64 61 | 74 69 6f 6e 2e 20 2a 2f |y founda|tion. */|
|00006260| 0d 09 20 0d 09 69 66 20 | 28 28 6c 6f 6e 67 29 20 |.. ..if |((long) |
|00006270| 47 65 74 41 70 70 6c 4c | 69 6d 69 74 28 29 20 2d |GetApplL|imit() -|
|00006280| 20 28 6c 6f 6e 67 29 20 | 41 70 70 6c 69 63 5a 6f | (long) |ApplicZo|
|00006290| 6e 65 28 29 20 3c 20 6b | 4d 69 6e 48 65 61 70 29 |ne() < k|MinHeap)|
|000062a0| 20 41 6c 65 72 74 55 73 | 65 72 28 29 3b 0d 09 0d | AlertUs|er();...|
|000062b0| 09 2f 2a 09 4e 65 78 74 | 2c 20 6d 61 6b 65 20 73 |./*.Next|, make s|
|000062c0| 75 72 65 20 74 68 61 74 | 20 65 6e 6f 75 67 68 20 |ure that| enough |
|000062d0| 6d 65 6d 6f 72 79 20 69 | 73 20 66 72 65 65 20 66 |memory i|s free f|
|000062e0| 6f 72 20 79 6f 75 72 20 | 61 70 70 6c 69 63 61 74 |or your |applicat|
|000062f0| 69 6f 6e 20 74 6f 20 72 | 75 6e 2e 20 49 74 0d 09 |ion to r|un. It..|
|00006300| 09 69 73 20 70 6f 73 73 | 69 62 6c 65 20 66 6f 72 |.is poss|ible for|
|00006310| 20 61 20 73 69 74 75 61 | 74 69 6f 6e 20 74 6f 20 | a situa|tion to |
|00006320| 61 72 69 73 65 20 77 68 | 65 72 65 20 74 68 65 20 |arise wh|ere the |
|00006330| 68 65 61 70 20 6d 61 79 | 20 68 61 76 65 20 62 65 |heap may| have be|
|00006340| 65 6e 20 6f 66 20 72 65 | 71 75 69 72 65 64 0d 09 |en of re|quired..|
|00006350| 09 73 69 7a 65 2c 20 62 | 75 74 20 61 20 6c 61 72 |.size, b|ut a lar|
|00006360| 67 65 20 73 63 72 61 70 | 20 77 61 73 20 6c 6f 61 |ge scrap| was loa|
|00006370| 64 65 64 20 77 68 69 63 | 68 20 6c 65 66 74 20 74 |ded whic|h left t|
|00006380| 6f 6f 20 6c 69 74 74 6c | 65 20 6d 65 6d 6f 72 79 |oo littl|e memory|
|00006390| 2e 20 54 6f 20 63 68 65 | 63 6b 20 66 6f 72 0d 09 |. To che|ck for..|
|000063a0| 09 74 68 69 73 2c 20 63 | 61 6c 6c 20 50 75 72 67 |.this, c|all Purg|
|000063b0| 65 53 70 61 63 65 20 61 | 6e 64 20 63 6f 6d 70 61 |eSpace a|nd compa|
|000063c0| 72 65 20 74 68 65 20 72 | 65 73 75 6c 74 20 77 69 |re the r|esult wi|
|000063d0| 74 68 20 61 20 76 61 6c | 75 65 20 74 68 61 74 20 |th a val|ue that |
|000063e0| 79 6f 75 20 68 61 76 65 | 20 64 65 74 65 72 6d 69 |you have| determi|
|000063f0| 6e 65 64 0d 09 09 69 73 | 20 74 68 65 20 6d 69 6e |ned...is| the min|
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.